using System.Collections.Generic;
using Content.Server.AI.Utility.Actions;
using Content.Server.AI.Utility.Actions.Clothing.OuterClothing;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Inventory;
using Content.Server.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
namespace Content.Server.AI.Utility.ExpandableActions.Clothing.OuterClothing
{
///
/// Equip any head item currently in our inventory
///
public sealed class EquipAnyOuterClothingExp : ExpandableUtilityAction
{
public override float Bonus => UtilityAction.NormalBonus;
public override IEnumerable GetActions(Blackboard context)
{
var owner = context.GetState().GetValue();
foreach (var entity in context.GetState().GetValue())
{
if (entity.TryGetComponent(out ClothingComponent clothing) &&
(clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.OUTERCLOTHING) != 0)
{
yield return new EquipOuterClothing(owner, entity, Bonus);
}
}
}
}
}