mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 14:07:53 +03:00
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.EntityEffects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server._Goobstation.EntityEffects.EffectConditions;
|
|
|
|
public sealed partial class StaminaDamageThreshold : EntityEffectCondition
|
|
{
|
|
[DataField]
|
|
public float Max = float.PositiveInfinity;
|
|
|
|
[DataField]
|
|
public float Min = -1;
|
|
|
|
public override bool Condition(EntityEffectBaseArgs args)
|
|
{
|
|
if (args.EntityManager.TryGetComponent(args.TargetEntity, out StaminaComponent? stamina))
|
|
{
|
|
var total = args.EntityManager.System<StaminaSystem>().GetStaminaDamage(args.TargetEntity, stamina);
|
|
if (total > Min && total < Max)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public override string GuidebookExplanation(IPrototypeManager prototype)
|
|
{
|
|
return Loc.GetString("reagent-effect-condition-guidebook-stamina-damage-threshold",
|
|
("max", float.IsPositiveInfinity(Max) ? (float) int.MaxValue : Max),
|
|
("min", Min));
|
|
}
|
|
}
|