Files
tbd-station-14/Content.Server/Destructible/Thresholds/Triggers/DamageTrigger.cs
2022-02-16 18:23:23 +11:00

27 lines
808 B
C#

using System;
using Content.Shared.Damage;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Destructible.Thresholds.Triggers
{
/// <summary>
/// A trigger that will activate when the amount of damage received
/// is above the specified threshold.
/// </summary>
[Serializable]
[DataDefinition]
public sealed class DamageTrigger : IThresholdTrigger
{
/// <summary>
/// The amount of damage at which this threshold will trigger.
/// </summary>
[DataField("damage", required: true)]
public int Damage { get; set; } = default!;
public bool Reached(DamageableComponent damageable, DestructibleSystem system)
{
return damageable.TotalDamage >= Damage;
}
}
}