DoActsBehavior.cs 837 B

12345678910111213141516171819202122232425262728293031
  1. namespace Content.Server.Destructible.Thresholds.Behaviors
  2. {
  3. [Serializable]
  4. [DataDefinition]
  5. public sealed partial class DoActsBehavior : IThresholdBehavior
  6. {
  7. /// <summary>
  8. /// What acts should be triggered upon activation.
  9. /// </summary>
  10. [DataField("acts")]
  11. public ThresholdActs Acts { get; set; }
  12. public bool HasAct(ThresholdActs act)
  13. {
  14. return (Acts & act) != 0;
  15. }
  16. public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
  17. {
  18. if (HasAct(ThresholdActs.Breakage))
  19. {
  20. system.BreakEntity(owner);
  21. }
  22. if (HasAct(ThresholdActs.Destruction))
  23. {
  24. system.DestroyEntity(owner);
  25. }
  26. }
  27. }
  28. }