Files
tbd-station-14/Content.Server/Destructible/Thresholds/Behaviors/DoActsBehavior.cs
2025-10-13 15:41:34 +00:00

34 lines
873 B
C#

using Content.Shared.Destructible;
namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed partial class DoActsBehavior : IThresholdBehavior
{
/// <summary>
/// What acts should be triggered upon activation.
/// </summary>
[DataField("acts")]
public ThresholdActs Acts { get; set; }
public bool HasAct(ThresholdActs act)
{
return (Acts & act) != 0;
}
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{
if (HasAct(ThresholdActs.Breakage))
{
system.BreakEntity(owner);
}
if (HasAct(ThresholdActs.Destruction))
{
system.DestroyEntity(owner);
}
}
}
}