Inventories (#61)

* Bully the fuck out of inventory shit
Inventory Stuff
Inventories technically work
It works technicaly speaking
Yeah this part too
Lets do it!
Inventories completed
Motherfucker

* Remove unnecessary usings and fix one thing

* Submodule update

* Adds a bunch of various clothing prototypes for each current inventory slot
This commit is contained in:
clusterfack
2018-04-25 06:42:35 -05:00
committed by Pieter-Jan Briers
parent ea05c593aa
commit c33c227d95
37 changed files with 1205 additions and 395 deletions

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Content.Shared.GameObjects.Components.Inventory
{
public static class EquipmentSlotDefines
{
public enum Slots
{
NONE,
HEAD,
EYES,
EARS,
MASK,
OUTERCLOTHING,
INNERCLOTHING,
BACKPACK,
BELT,
GLOVES,
SHOES,
IDCARD,
POCKET1,
POCKET2,
POCKET3,
POCKET4,
EXOSUITSLOT1,
EXOSUITSLOT2
}
[Flags]
public enum SlotFlags
{
NONE = 0,
PREVENTEQUIP = 1 << 0,
HEAD = 1 << 1,
HELMET = 1 << 1,
EYES = 1 << 2,
EARS = 1 << 3,
MASK = 1 << 4,
OUTERCLOTHING = 1 << 5,
INNERCLOTHING = 1 << 6,
BACK = 1 << 7,
BACKPACK = 1 << 7,
BELT = 1 << 8,
GLOVES = 1 << 9,
HAND = 1 << 9,
IDCARD = 1 << 10,
POCKET = 1 << 11,
LEGS = 1 << 12,
SHOES = 1 << 13,
FEET = 1 << 13,
EXOSUITSTORAGE = 1 << 14
}
public static Dictionary<Slots, string> SlotNames = new Dictionary<Slots, string>()
{
{Slots.HEAD, "Head" },
{Slots.EYES, "Eyes" },
{Slots.EARS, "Ears" },
{Slots.MASK, "Mask" },
{Slots.OUTERCLOTHING, "Outer Clothing" },
{Slots.INNERCLOTHING, "Inner Clothing" },
{Slots.BACKPACK, "Backpack" },
{Slots.BELT, "Belt" },
{Slots.GLOVES, "Gloves" },
{Slots.SHOES, "Shoes" },
{Slots.IDCARD, "Id Card" },
{Slots.POCKET1, "Left Pocket" },
{Slots.POCKET2, "Right Pocket" },
{Slots.POCKET3, "Up Pocket" },
{Slots.POCKET4, "Down Pocket" },
{Slots.EXOSUITSLOT1, "Suit Storage" },
{Slots.EXOSUITSLOT2, "Backup Storage" }
};
public static Dictionary<Slots, SlotFlags> SlotMasks = new Dictionary<Slots, SlotFlags>()
{
{Slots.HEAD, SlotFlags.HEAD },
{Slots.EYES, SlotFlags.EYES },
{Slots.EARS, SlotFlags.EARS },
{Slots.MASK, SlotFlags.MASK },
{Slots.OUTERCLOTHING, SlotFlags.OUTERCLOTHING },
{Slots.INNERCLOTHING, SlotFlags.INNERCLOTHING },
{Slots.BACKPACK, SlotFlags.BACK },
{Slots.BELT, SlotFlags.BELT },
{Slots.GLOVES, SlotFlags.GLOVES },
{Slots.SHOES, SlotFlags.FEET },
{Slots.IDCARD, SlotFlags.IDCARD },
{Slots.POCKET1, SlotFlags.POCKET },
{Slots.POCKET2, SlotFlags.POCKET },
{Slots.POCKET3, SlotFlags.POCKET },
{Slots.POCKET4, SlotFlags.POCKET },
{Slots.EXOSUITSLOT1, SlotFlags.EXOSUITSTORAGE },
{Slots.EXOSUITSLOT2, SlotFlags.EXOSUITSTORAGE }
};
}
}

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Shared.GameObjects
{
public abstract class Inventory
{
abstract public int Columns { get; }
abstract public List<Slots> SlotMasks { get; }
}
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
};
}
}

View File

@@ -0,0 +1,54 @@
using SS14.Shared.GameObjects;
using SS14.Shared.Serialization;
using System;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Shared.GameObjects
{
public abstract class SharedInventoryComponent : Component
{
public sealed override string Name => "Inventory";
public override uint? NetID => ContentNetIDs.STORAGE;
[Serializable, NetSerializable]
public class ServerInventoryMessage : ComponentMessage
{
public Slots Inventoryslot;
public EntityUid EntityUid;
public ServerInventoryUpdate Updatetype;
public ServerInventoryMessage()
{
Directed = true;
}
public enum ServerInventoryUpdate
{
Removal = 0,
Addition = 1
}
}
[Serializable, NetSerializable]
public class ClientInventoryMessage : ComponentMessage
{
public Slots Inventoryslot;
public ClientInventoryUpdate Updatetype;
public ClientInventoryMessage(Slots inventoryslot, ClientInventoryUpdate updatetype)
{
Directed = true;
Inventoryslot = inventoryslot;
Updatetype = updatetype;
}
public enum ClientInventoryUpdate
{
Equip = 0,
Unequip = 1
}
}
}
}

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.GameObjects.Components.Storage
public abstract class SharedStorageComponent : Component
{
public sealed override string Name => "Storage";
public override uint? NetID => ContentNetIDs.STORAGE;
public override uint? NetID => ContentNetIDs.INVENTORY;
}
/// <summary>