2021-08-24 00:50:39 -06:00
|
|
|
|
using System;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Damage.Components;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2021-02-05 13:41:05 +01:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.Destructible.Thresholds.Triggers
|
2021-02-05 13:41:05 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2021-02-09 12:57:21 +01:00
|
|
|
|
/// A trigger that will activate when the amount of damage received
|
2021-02-05 13:41:05 +01:00
|
|
|
|
/// is above the specified threshold.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Serializable]
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataDefinition]
|
2021-02-09 12:57:21 +01:00
|
|
|
|
public class DamageTrigger : IThresholdTrigger
|
2021-02-05 13:41:05 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2021-02-09 12:57:21 +01:00
|
|
|
|
/// The amount of damage at which this threshold will trigger.
|
2021-02-05 13:41:05 +01:00
|
|
|
|
/// </summary>
|
2021-08-24 00:50:39 -06:00
|
|
|
|
[DataField("damage")]
|
|
|
|
|
|
public int Damage { get; set; }
|
2021-02-05 13:41:05 +01:00
|
|
|
|
|
|
|
|
|
|
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
|
|
|
|
|
{
|
|
|
|
|
|
return damageable.TotalDamage >= Damage;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|