Files
tbd-station-14/Content.Server/AI/WorldState/States/Hands/AnyFreeHandState.cs
2021-06-09 22:19:39 +02:00

29 lines
717 B
C#

using Content.Server.Hands.Components;
using JetBrains.Annotations;
namespace Content.Server.AI.WorldState.States.Hands
{
[UsedImplicitly]
public class AnyFreeHandState : StateData<bool>
{
public override string Name => "AnyFreeHand";
public override bool GetValue()
{
if (!Owner.TryGetComponent(out HandsComponent? handsComponent))
{
return false;
}
foreach (var hand in handsComponent.ActivePriorityEnumerable())
{
if (handsComponent.GetItem(hand) == null)
{
return true;
}
}
return false;
}
}
}