Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com> Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using Content.Server.GameObjects;
|
|
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;
|
|
}
|
|
}
|
|
}
|