CatStation/Content.Server/Destructible/Thresholds/DamageThreshold.cs
Princess Cheeseballs 2d9eb843d3
Custom DamageThreshold Serializer (#44798)
* i shitted

* fsasfaasffasfsafsafsafsafsasfasfa

* typo

* remove TODO that I forgot about

---------

Co-authored-by: iaada <iaada@users.noreply.github.com>
2026-07-21 05:44:55 +00:00

48 lines
1.5 KiB
C#

using Content.Server.Destructible.Thresholds.Behaviors;
using Content.Shared.Destructible.Thresholds.Triggers;
namespace Content.Server.Destructible.Thresholds;
[DataDefinition]
public sealed partial class DamageThreshold : IComparable<DamageThreshold>
{
/// <summary>
/// Whether or not this threshold was triggered in the previous call to
/// <see cref="Reached"/>.
/// </summary>
[ViewVariables] public bool OldTriggered;
/// <summary>
/// Whether or not this threshold has already been triggered.
/// </summary>
[DataField]
public bool Triggered;
/// <summary>
/// Whether or not this threshold only triggers once.
/// If false, it will trigger again once the entity is healed
/// and then damaged to reach this threshold once again.
/// It will not repeatedly trigger as damage rises beyond that.
/// </summary>
[DataField]
public bool TriggersOnce;
/// <summary>
/// The condition that decides if this threshold has been reached.
/// Gets evaluated each time the entity's damage changes.
/// </summary>
[DataField(required: true)]
public IThresholdTrigger Trigger;
/// <summary>
/// Behaviors to activate once this threshold is triggered.
/// TODO: Replace with EntityEffects.
/// </summary>
[DataField]
public List<IThresholdBehavior> Behaviors = new();
public int CompareTo(DamageThreshold? other)
{
return Trigger.CompareTo(other?.Trigger);
}
}