ActiveHandFreePrecondition.cs 507 B

12345678910111213141516
  1. using Content.Shared.Hands.Components;
  2. namespace Content.Server.NPC.HTN.Preconditions;
  3. /// <summary>
  4. /// Returns true if the active hand is unoccupied.
  5. /// </summary>
  6. public sealed partial class ActiveHandFreePrecondition : HTNPrecondition
  7. {
  8. [Dependency] private readonly IEntityManager _entManager = default!;
  9. public override bool IsMet(NPCBlackboard blackboard)
  10. {
  11. return blackboard.TryGetValue<bool>(NPCBlackboard.ActiveHandFree, out var handFree, _entManager) && handFree;
  12. }
  13. }