Files
tbd-station-14/Content.Server/AI/WorldState/States/Hands/AnyFreeHandState.cs
metalgearsloth 5391d3c72a Add utility AI (#806)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2020-06-18 14:52:44 +02:00

29 lines
711 B
C#

using Content.Server.GameObjects;
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.GetHand(hand) == null)
{
return true;
}
}
return false;
}
}
}