2020-06-18 22:52:44 +10:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Content.Server.AI.Utility.Actions;
|
|
|
|
|
using Content.Server.AI.Utility.Actions.Clothing.Gloves;
|
2020-08-12 06:01:55 +10:00
|
|
|
using Content.Server.AI.Utility.Considerations;
|
|
|
|
|
using Content.Server.AI.Utility.Considerations.Clothing;
|
2020-06-18 22:52:44 +10:00
|
|
|
using Content.Server.AI.WorldState;
|
|
|
|
|
using Content.Server.AI.WorldState.States;
|
|
|
|
|
using Content.Server.AI.WorldState.States.Inventory;
|
2020-08-13 14:40:27 +02:00
|
|
|
using Content.Server.GameObjects.Components.Items.Clothing;
|
2020-06-18 22:52:44 +10:00
|
|
|
using Content.Shared.GameObjects.Components.Inventory;
|
2020-08-12 06:01:55 +10:00
|
|
|
using Robust.Shared.IoC;
|
2020-06-18 22:52:44 +10:00
|
|
|
|
|
|
|
|
namespace Content.Server.AI.Utility.ExpandableActions.Clothing.Gloves
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Equip any head item currently in our inventory
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class EquipAnyGlovesExp : ExpandableUtilityAction
|
|
|
|
|
{
|
|
|
|
|
public override float Bonus => UtilityAction.NormalBonus;
|
|
|
|
|
|
2020-08-12 06:01:55 +10:00
|
|
|
protected override IEnumerable<Func<float>> GetCommonConsiderations(Blackboard context)
|
|
|
|
|
{
|
|
|
|
|
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();
|
|
|
|
|
|
|
|
|
|
return new []
|
|
|
|
|
{
|
|
|
|
|
considerationsManager.Get<ClothingInSlotCon>().Slot(EquipmentSlotDefines.Slots.GLOVES, context)
|
|
|
|
|
.InverseBoolCurve(context),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-18 22:52:44 +10:00
|
|
|
public override IEnumerable<UtilityAction> GetActions(Blackboard context)
|
|
|
|
|
{
|
|
|
|
|
var owner = context.GetState<SelfState>().GetValue();
|
|
|
|
|
|
2020-07-08 09:37:35 +10:00
|
|
|
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
2020-06-18 22:52:44 +10:00
|
|
|
{
|
|
|
|
|
if (entity.TryGetComponent(out ClothingComponent clothing) &&
|
|
|
|
|
(clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.GLOVES) != 0)
|
|
|
|
|
{
|
2021-02-20 17:37:17 +11:00
|
|
|
yield return new EquipGloves {Owner = owner, Target = entity, Bonus = Bonus};
|
2020-06-18 22:52:44 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|