Equipment & inhands. (#110)
* Equipment WiP * Equipment's starting to work. * Equipment works properly 100% now. * Inhands work. Also more clothes.
This commit is contained in:
committed by
GitHub
parent
c612806ef1
commit
74541e23a4
@@ -3,11 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SS14.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Inventory
|
||||
{
|
||||
public static class EquipmentSlotDefines
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public enum Slots
|
||||
{
|
||||
NONE,
|
||||
@@ -30,6 +32,7 @@ namespace Content.Shared.GameObjects.Components.Inventory
|
||||
EXOSUITSLOT2
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
[Flags]
|
||||
public enum SlotFlags
|
||||
{
|
||||
|
||||
@@ -5,21 +5,50 @@ namespace Content.Shared.GameObjects
|
||||
{
|
||||
public abstract class Inventory
|
||||
{
|
||||
abstract public int Columns { get; }
|
||||
public abstract int Columns { get; }
|
||||
|
||||
abstract public List<Slots> SlotMasks { 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);
|
||||
}
|
||||
|
||||
public class HumanInventory : Inventory
|
||||
{
|
||||
public override int Columns => 3;
|
||||
|
||||
public override List<Slots> SlotMasks => 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
|
||||
};
|
||||
private static Dictionary<Slots, int> _slotDrawingOrder = new Dictionary<Slots, int>
|
||||
{
|
||||
{Slots.HEAD, 10},
|
||||
{Slots.MASK, 9},
|
||||
{Slots.EARS, 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
|
||||
};
|
||||
|
||||
public override int SlotDrawingOrder(Slots slot)
|
||||
{
|
||||
return _slotDrawingOrder.TryGetValue(slot, out var val) ? val : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using SS14.Shared.GameObjects;
|
||||
using SS14.Shared.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
||||
|
||||
namespace Content.Shared.GameObjects
|
||||
@@ -8,26 +9,17 @@ namespace Content.Shared.GameObjects
|
||||
public abstract class SharedInventoryComponent : Component
|
||||
{
|
||||
public sealed override string Name => "Inventory";
|
||||
|
||||
public override uint? NetID => ContentNetIDs.STORAGE;
|
||||
|
||||
public sealed override uint? NetID => ContentNetIDs.STORAGE;
|
||||
public sealed override Type StateType => typeof(InventoryComponentState);
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class ServerInventoryMessage : ComponentMessage
|
||||
protected class InventoryComponentState : ComponentState
|
||||
{
|
||||
public Slots Inventoryslot;
|
||||
public EntityUid EntityUid;
|
||||
public ServerInventoryUpdate Updatetype;
|
||||
public List<KeyValuePair<Slots, EntityUid>> Entities { get; }
|
||||
|
||||
public ServerInventoryMessage()
|
||||
public InventoryComponentState(List<KeyValuePair<Slots, EntityUid>> entities) : base(ContentNetIDs.STORAGE)
|
||||
{
|
||||
Directed = true;
|
||||
}
|
||||
|
||||
public enum ServerInventoryUpdate
|
||||
{
|
||||
Removal = 0,
|
||||
Addition = 1
|
||||
Entities = entities;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user