Files
tbd-station-14/Content.Server/Destructible/Thresholds/Behaviors/DoActsBehavior.cs
Javier Guardia Fernández 42aaba9a5d Remove most IEntity usages from explosions (#5240)
* Remove most IEntity usages from Destructible and Explosions

* Perform a minute amount of cleanup

* Fix build
2021-11-09 21:24:35 +01:00

38 lines
998 B
C#

using System;
using Content.Shared.Acts;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public class DoActsBehavior : IThresholdBehavior
{
/// <summary>
/// What acts should be triggered upon activation.
/// See <see cref="ActSystem"/>.
/// </summary>
[DataField("acts")]
public ThresholdActs Acts { get; set; }
public bool HasAct(ThresholdActs act)
{
return (Acts & act) != 0;
}
public void Execute(EntityUid owner, DestructibleSystem system)
{
if (HasAct(ThresholdActs.Breakage))
{
system.ActSystem.HandleBreakage(owner);
}
if (HasAct(ThresholdActs.Destruction))
{
system.ActSystem.HandleDestruction(owner);
}
}
}
}