Files
tbd-station-14/Content.Server/AI/WorldState/States/Clothing/EquippedClothingState.cs
DrSmugleaf 4a8ed41e3a Fix namespaces and optimize imports (#1651)
* Fix namespaces and optimize imports

* Cleanup fixes

* Merge conflict fixes

* Merge conflict fixes

* Merge conflict fixes
2020-08-13 14:40:27 +02:00

38 lines
1.2 KiB
C#

using System.Collections.Generic;
using Content.Server.GameObjects.Components.GUI;
using Content.Shared.GameObjects.Components.Inventory;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.WorldState.States.Clothing
{
[UsedImplicitly]
public sealed class EquippedClothingState : StateData<Dictionary<EquipmentSlotDefines.Slots, IEntity>>
{
public override string Name => "EquippedClothing";
public override Dictionary<EquipmentSlotDefines.Slots, IEntity> GetValue()
{
var result = new Dictionary<EquipmentSlotDefines.Slots, IEntity>();
if (!Owner.TryGetComponent(out InventoryComponent inventoryComponent))
{
return result;
}
foreach (var slot in EquipmentSlotDefines.AllSlots)
{
if (!inventoryComponent.HasSlot(slot)) continue;
var slotItem = inventoryComponent.GetSlotItem(slot);
if (slotItem != null)
{
result.Add(slot, slotItem.Owner);
}
}
return result;
}
}
}