2021-02-27 04:12:09 +01:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
using System.Collections.Generic;
|
2019-07-23 23:24:47 +02:00
|
|
|
|
using JetBrains.Annotations;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
2018-04-25 06:42:35 -05:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Shared.Inventory
|
2018-04-25 06:42:35 -05:00
|
|
|
|
{
|
|
|
|
|
|
public abstract class Inventory
|
|
|
|
|
|
{
|
2019-07-23 23:24:47 +02:00
|
|
|
|
public abstract string InterfaceControllerTypeName { get; }
|
2018-04-25 06:42:35 -05:00
|
|
|
|
|
2018-09-19 18:54:04 +02:00
|
|
|
|
public abstract IReadOnlyList<Slots> SlotMasks { get; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the drawing order of a slot.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>
|
|
|
|
|
|
/// An int that can be used for sorting relative to other drawing orders.
|
|
|
|
|
|
/// The value returned does not mean anything else.
|
|
|
|
|
|
/// </returns>
|
|
|
|
|
|
public abstract int SlotDrawingOrder(Slots slot);
|
2018-04-25 06:42:35 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-07-23 23:24:47 +02:00
|
|
|
|
// Dynamically created by SharedInventoryComponent.
|
|
|
|
|
|
[UsedImplicitly]
|
2018-04-25 06:42:35 -05:00
|
|
|
|
public class HumanInventory : Inventory
|
|
|
|
|
|
{
|
2019-07-23 23:24:47 +02:00
|
|
|
|
public override string InterfaceControllerTypeName => "HumanInventoryInterfaceController";
|
2018-04-25 06:42:35 -05:00
|
|
|
|
|
2020-11-27 11:00:49 +01:00
|
|
|
|
private static readonly Dictionary<Slots, int> _slotDrawingOrder = new()
|
2018-09-19 18:54:04 +02:00
|
|
|
|
{
|
2020-06-21 20:02:18 +00:00
|
|
|
|
{Slots.POCKET1, 13},
|
|
|
|
|
|
{Slots.POCKET2, 12},
|
|
|
|
|
|
{Slots.HEAD, 11},
|
|
|
|
|
|
{Slots.MASK, 10},
|
|
|
|
|
|
{Slots.EARS, 9},
|
|
|
|
|
|
{Slots.NECK, 8},
|
2018-09-19 18:54:04 +02:00
|
|
|
|
{Slots.BACKPACK, 7},
|
|
|
|
|
|
{Slots.EYES, 6},
|
|
|
|
|
|
{Slots.OUTERCLOTHING, 5},
|
|
|
|
|
|
{Slots.BELT, 4},
|
|
|
|
|
|
{Slots.GLOVES, 3},
|
|
|
|
|
|
{Slots.SHOES, 2},
|
|
|
|
|
|
{Slots.IDCARD, 1},
|
|
|
|
|
|
{Slots.INNERCLOTHING, 0}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public override IReadOnlyList<Slots> SlotMasks { get; } = new List<Slots>()
|
|
|
|
|
|
{
|
|
|
|
|
|
Slots.EYES, Slots.HEAD, Slots.EARS,
|
2020-08-13 14:40:27 +02:00
|
|
|
|
Slots.OUTERCLOTHING, Slots.MASK, Slots.INNERCLOTHING,
|
2018-09-19 18:54:04 +02:00
|
|
|
|
Slots.BACKPACK, Slots.BELT, Slots.GLOVES,
|
2020-06-21 20:02:18 +00:00
|
|
|
|
Slots.NONE, Slots.SHOES, Slots.IDCARD, Slots.POCKET1, Slots.POCKET2,
|
|
|
|
|
|
Slots.NECK
|
2018-09-19 18:54:04 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public override int SlotDrawingOrder(Slots slot)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _slotDrawingOrder.TryGetValue(slot, out var val) ? val : 0;
|
|
|
|
|
|
}
|
2018-04-25 06:42:35 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|