Files
tbd-station-14/Content.Server/AI/WorldState/States/Hands/FreeHands.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

33 lines
813 B
C#

using System.Collections.Generic;
using Content.Server.GameObjects;
using JetBrains.Annotations;
namespace Content.Server.AI.WorldState.States.Hands
{
[UsedImplicitly]
public sealed class FreeHands : StateData<List<string>>
{
public override string Name => "FreeHands";
public override List<string> GetValue()
{
var result = new List<string>();
if (!Owner.TryGetComponent(out HandsComponent handsComponent))
{
return result;
}
foreach (var hand in handsComponent.ActivePriorityEnumerable())
{
if (handsComponent.GetHand(hand) == null)
{
result.Add(hand);
}
}
return result;
}
}
}