Files
tbd-station-14/Content.Server/NPC/HTN/Preconditions/Math/KeyFloatEqualsPrecondition.cs
Tornado Tech 31491775e5 Added new HTN operations and preconditions (#27486)
* Added new HTN operations & preconditions

* Ok I forgot about partial

* Namespace pierce the skies

* Some fixes, debug and new operators

* Bruh git eat my files
2024-05-08 12:18:03 +03:00

19 lines
535 B
C#

namespace Content.Server.NPC.HTN.Preconditions.Math;
public sealed partial class KeyFloatEqualsPrecondition : HTNPrecondition
{
[Dependency] private readonly IEntityManager _entManager = default!;
[DataField(required: true)]
public string Key = string.Empty;
[DataField(required: true)]
public float Value;
public override bool IsMet(NPCBlackboard blackboard)
{
return blackboard.TryGetValue<float>(Key, out var value, _entManager) &&
MathHelper.CloseTo(value, value);
}
}