DamageTrigger.cs 748 B

123456789101112131415161718192021222324
  1. using Content.Shared.Damage;
  2. namespace Content.Server.Destructible.Thresholds.Triggers
  3. {
  4. /// <summary>
  5. /// A trigger that will activate when the amount of damage received
  6. /// is above the specified threshold.
  7. /// </summary>
  8. [Serializable]
  9. [DataDefinition]
  10. public sealed partial class DamageTrigger : IThresholdTrigger
  11. {
  12. /// <summary>
  13. /// The amount of damage at which this threshold will trigger.
  14. /// </summary>
  15. [DataField("damage", required: true)]
  16. public int Damage { get; set; } = default!;
  17. public bool Reached(DamageableComponent damageable, DestructibleSystem system)
  18. {
  19. return damageable.TotalDamage >= Damage;
  20. }
  21. }
  22. }