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

@@ -5,37 +5,21 @@ using SS14.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects
{
public class ItemComponent : StoreableComponent, IItemComponent, EntitySystems.IAttackHand
public class ItemComponent : StoreableComponent, EntitySystems.IAttackHand
{
public override string Name => "Item";
/// <inheritdoc />
public IInventorySlot ContainingSlot { get; private set; }
public void RemovedFromSlot()
{
if (ContainingSlot == null)
{
throw new InvalidOperationException("Item is not in a slot.");
}
ContainingSlot = null;
foreach (var component in Owner.GetComponents<ISpriteRenderableComponent>())
{
component.Visible = true;
}
}
public void EquippedToSlot(IInventorySlot slot)
public void EquippedToSlot(ContainerSlot slot)
{
if (ContainingSlot != null)
{
throw new InvalidOperationException("Item is already in a slot.");
}
ContainingSlot = slot;
foreach (var component in Owner.GetComponents<ISpriteRenderableComponent>())
{
component.Visible = false;
@@ -44,10 +28,6 @@ namespace Content.Server.GameObjects
public bool Attackhand(IEntity user)
{
if (ContainingSlot != null)
{
return false;
}
var hands = user.GetComponent<IHandsComponent>();
hands.PutInHand(this, hands.ActiveIndex, fallback: false);
return true;

View File

@@ -28,7 +28,7 @@ namespace Content.Server.GameObjects
{
base.OnAdd();
storage = Container.Create("storagebase", Owner);
storage = ContainerManagerComponent.Create<Container>("storagebase", Owner);
}
public override void ExposeData(EntitySerializer serializer)
@@ -105,7 +105,7 @@ namespace Content.Server.GameObjects
else
{
//Return the object to the hand since its too big or something like that
hands.PutInHand(attackwith.GetComponent<IItemComponent>());
hands.PutInHand(attackwith.GetComponent<ItemComponent>());
}
}
return false;
@@ -167,7 +167,7 @@ namespace Content.Server.GameObjects
Remove(entity);
UpdateClientInventory();
var item = entity.GetComponent<IItemComponent>();
var item = entity.GetComponent<ItemComponent>();
if (item != null && playerentity.TryGetComponent(out HandsComponent hands))
{
if (hands.PutInHand(item))

View File

@@ -30,6 +30,7 @@ namespace Content.Server.GameObjects
Wallet = 4,
Pocket = 12,
Box = 24,
Belt = 30,
Toolbox = 60,
Backpack = 100,
NoStoring = 9999