Files
tbd-station-14/Content.Server/NPC/HTN/Preconditions/Math/KeyFloatGreaterPrecondition.cs
Tornado Tech a29b6a6894 Clean up new HTNs tasks (#28469)
* Clean up new HTNs tasks

* Added docs to math operations
2024-06-01 13:46:35 -04:00

22 lines
810 B
C#

namespace Content.Server.NPC.HTN.Preconditions.Math;
/// <summary>
/// Checks if there is a float value for the specified <see cref="KeyFloatGreaterPrecondition.Key"/>
/// in the <see cref="NPCBlackboard"/> and the specified value is greater then <see cref="KeyFloatGreaterPrecondition.Value"/>.
/// </summary>
public sealed partial class KeyFloatGreaterPrecondition : HTNPrecondition
{
[Dependency] private readonly IEntityManager _entManager = default!;
[DataField(required: true), ViewVariables]
public string Key = string.Empty;
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
public float Value;
public override bool IsMet(NPCBlackboard blackboard)
{
return blackboard.TryGetValue<float>(Key, out var value, _entManager) && value > Value;
}
}