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

23 lines
728 B
C#

using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States.Clothing;
namespace Content.Server.AI.Utility.Considerations.Clothing
{
public sealed class ClothingInSlotCon : Consideration
{
public ClothingInSlotCon Slot(string slot, Blackboard context)
{
context.GetState<ClothingSlotConState>().SetValue(slot);
return this;
}
protected override float GetScore(Blackboard context)
{
var slot = context.GetState<ClothingSlotConState>().GetValue();
var inventory = context.GetState<EquippedClothingState>().GetValue();
return slot != null && inventory.ContainsKey(slot) ? 1.0f : 0.0f;
}
}
}