* Add nullable to some Content.Shared files. * Use [NotNullWhen(true)] * Undo adding now redundant !'s * Forgot one * Add a ton more nullable * You can guess * Fix some issues * It actually compiles now * Auto stash before merge of "null2" and "origin/master" * I lied * enable annotations -> enable * Revert ActionBlockerSystem.cs to original * Fix ActionBlockerSystem.cs * More nullable * Undo some added exclamation marks * Fix issues * Update Content.Shared/Maps/ContentTileDefinition.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Resolve some issues * Remove unused method * Fix more issues * Fix more issues * Fix more issues * Fix more issues * Fix issue, rollback SharedGhostComponent.cs * Update submodule * Fix issue, invert some if-statements to reduce nesting * Revert RobustToolbox * FIx things broken by merge * Some fixes - Replaced with string.Empty - Remove some exclamation marks - Revert file * Some fixes * Trivial #nullable enable * Fix null ables Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
using JetBrains.Annotations;
|
|
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
|
|
|
namespace Content.Shared.GameObjects.Components.Inventory
|
|
{
|
|
public abstract class Inventory
|
|
{
|
|
public abstract string InterfaceControllerTypeName { get; }
|
|
|
|
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);
|
|
}
|
|
|
|
// Dynamically created by SharedInventoryComponent.
|
|
[UsedImplicitly]
|
|
public class HumanInventory : Inventory
|
|
{
|
|
public override string InterfaceControllerTypeName => "HumanInventoryInterfaceController";
|
|
|
|
private static readonly Dictionary<Slots, int> _slotDrawingOrder = new()
|
|
{
|
|
{Slots.POCKET1, 13},
|
|
{Slots.POCKET2, 12},
|
|
{Slots.HEAD, 11},
|
|
{Slots.MASK, 10},
|
|
{Slots.EARS, 9},
|
|
{Slots.NECK, 8},
|
|
{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,
|
|
Slots.OUTERCLOTHING, Slots.MASK, Slots.INNERCLOTHING,
|
|
Slots.BACKPACK, Slots.BELT, Slots.GLOVES,
|
|
Slots.NONE, Slots.SHOES, Slots.IDCARD, Slots.POCKET1, Slots.POCKET2,
|
|
Slots.NECK
|
|
};
|
|
|
|
public override int SlotDrawingOrder(Slots slot)
|
|
{
|
|
return _slotDrawingOrder.TryGetValue(slot, out var val) ? val : 0;
|
|
}
|
|
}
|
|
}
|