Files
tbd-station-14/Content.Server/AI/Utility/Considerations/Hands/FreeHandCon.cs
2022-05-13 17:59:03 +10:00

22 lines
674 B
C#

using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Shared.Hands.Components;
namespace Content.Server.AI.Utility.Considerations.Hands
{
public sealed class FreeHandCon : Consideration
{
protected override float GetScore(Blackboard context)
{
var owner = context.GetState<SelfState>().GetValue();
if (!owner.IsValid() || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out SharedHandsComponent? handsComponent))
{
return 0.0f;
}
return (float) handsComponent.CountFreeHands() / handsComponent.Count;
}
}
}