mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-13 20:31:10 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
22 lines
709 B
C#
22 lines
709 B
C#
using Content.Server.Hands.Systems;
|
|
|
|
namespace Content.Server.NPC.HTN.Preconditions;
|
|
|
|
/// <summary>
|
|
/// Returns true if an entity is held in the active hand.
|
|
/// </summary>
|
|
public sealed partial class ActiveHandEntityPrecondition : HTNPrecondition
|
|
{
|
|
[Dependency] private IEntityManager _entManager = default!;
|
|
|
|
public override bool IsMet(NPCBlackboard blackboard)
|
|
{
|
|
if (!blackboard.TryGetValue(NPCBlackboard.Owner, out EntityUid owner, _entManager) ||
|
|
!blackboard.TryGetValue(NPCBlackboard.ActiveHand, out string? activeHand, _entManager))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return !_entManager.System<HandsSystem>().HandIsEmpty(owner, activeHand);
|
|
}
|
|
}
|