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:
committed by
Pieter-Jan Briers
parent
ea05c593aa
commit
c33c227d95
@@ -1,4 +1,5 @@
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using Content.Server.GameObjects;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Content.Server.Interfaces.GameObjects
|
||||
@@ -13,26 +14,26 @@ namespace Content.Server.Interfaces.GameObjects
|
||||
/// <summary>
|
||||
/// Enumerates over every held item.
|
||||
/// </summary>
|
||||
IEnumerable<IItemComponent> GetAllHeldItems();
|
||||
IEnumerable<ItemComponent> GetAllHeldItems();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item held by a hand.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the hand to get.</param>
|
||||
/// <returns>The item in the held, null if no item is held</returns>
|
||||
IItemComponent GetHand(string index);
|
||||
ItemComponent GetHand(string index);
|
||||
|
||||
/// <summary>
|
||||
/// Gets item held by the current active hand
|
||||
/// </summary>
|
||||
IItemComponent GetActiveHand { get; }
|
||||
ItemComponent GetActiveHand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Puts an item into any empty hand, preferring the active hand.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to put in a hand.</param>
|
||||
/// <returns>True if the item was inserted, false otherwise.</returns>
|
||||
bool PutInHand(IItemComponent item);
|
||||
bool PutInHand(ItemComponent item);
|
||||
|
||||
/// <summary>
|
||||
/// Puts an item into a specific hand.
|
||||
@@ -40,17 +41,17 @@ namespace Content.Server.Interfaces.GameObjects
|
||||
/// <param name="item">The item to put in the hand.</param>
|
||||
/// <param name="index">The index of the hand to put the item into.</param>
|
||||
/// <param name="fallback">
|
||||
/// If true and the provided hand is full, the method will fall back to <see cref="PutInHand(IItemComponent)" />
|
||||
/// If true and the provided hand is full, the method will fall back to <see cref="PutInHand(ItemComponent)" />
|
||||
/// </param>
|
||||
/// <returns>True if the item was inserted into a hand, false otherwise.</returns>
|
||||
bool PutInHand(IItemComponent item, string index, bool fallback=true);
|
||||
bool PutInHand(ItemComponent item, string index, bool fallback=true);
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if an item can be put in any hand.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to check for.</param>
|
||||
/// <returns>True if the item can be inserted, false otherwise.</returns>
|
||||
bool CanPutInHand(IItemComponent item);
|
||||
bool CanPutInHand(ItemComponent item);
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if an item can be put in the specified hand.
|
||||
@@ -58,7 +59,7 @@ namespace Content.Server.Interfaces.GameObjects
|
||||
/// <param name="item">The item to check for.</param>
|
||||
/// <param name="index">The index for the hand to check for.</param>
|
||||
/// <returns>True if the item can be inserted, false otherwise.</returns>
|
||||
bool CanPutInHand(IItemComponent item, string index);
|
||||
bool CanPutInHand(ItemComponent item, string index);
|
||||
|
||||
/// <summary>
|
||||
/// Drops an item on the ground, removing it from the hand.
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
using SS14.Server.Interfaces.GameObjects;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using System;
|
||||
|
||||
namespace Content.Server.Interfaces.GameObjects
|
||||
{
|
||||
public interface IInventoryComponent : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the item in the specified slot.
|
||||
/// </summary>
|
||||
/// <param name="slot">The slot to get the item for.</param>
|
||||
/// <returns>Null if the slot is empty, otherwise the item.</returns>
|
||||
IItemComponent Get(string slot);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the slot with specified name.
|
||||
/// This gets the slot, NOT the item contained therein.
|
||||
/// </summary>
|
||||
/// <param name="slot">The name of the slot to get.</param>
|
||||
IInventorySlot GetSlot(string slot);
|
||||
|
||||
/// <summary>
|
||||
/// Puts an item in a slot.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This will fail if there is already an item in the specified slot.
|
||||
/// </remarks>
|
||||
/// <param name="slot">The slot to put the item in.</param>
|
||||
/// <param name="item">The item to insert into the slot.</param>
|
||||
/// <returns>True if the item was successfully inserted, false otherwise.</returns>
|
||||
bool Insert(string slot, IItemComponent item);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether an item can be put in the specified slot.
|
||||
/// </summary>
|
||||
/// <param name="slot">The slot to check for.</param>
|
||||
/// <param name="item">The item to check for.</param>
|
||||
/// <returns>True if the item can be inserted into the specified slot.</returns>
|
||||
bool CanInsert(string slot, IItemComponent item);
|
||||
|
||||
/// <summary>
|
||||
/// Drops the item in a slot.
|
||||
/// </summary>
|
||||
/// <param name="slot">The slot to drop the item from.</param>
|
||||
/// <returns>True if an item was dropped, false otherwise.</returns>
|
||||
bool Drop(string slot);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether an item can be dropped from the specified slot.
|
||||
/// </summary>
|
||||
/// <param name="slot">The slot to check for.</param>
|
||||
/// <returns>
|
||||
/// True if there is an item in the slot and it can be dropped, false otherwise.
|
||||
/// </returns>
|
||||
bool CanDrop(string slot);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new slot to this inventory component.
|
||||
/// </summary>
|
||||
/// <param name="slot">The name of the slot to add.</param>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown if the slot with specified name already exists.
|
||||
/// </exception>
|
||||
IInventorySlot AddSlot(string slot);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a slot from this inventory component.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the slot contains an item, the item is dropped.
|
||||
/// </remarks>
|
||||
/// <param name="slot">The name of the slot to remove.</param>
|
||||
void RemoveSlot(string slot);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether a slot with the specified name exists.
|
||||
/// </summary>
|
||||
/// <param name="slot">The slot name to check.</param>
|
||||
/// <returns>True if the slot exists, false otherwise.</returns>
|
||||
bool HasSlot(string slot);
|
||||
}
|
||||
|
||||
public interface IInventorySlot
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the slot.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The item contained in the slot, can be null.
|
||||
/// </summary>
|
||||
IItemComponent Item { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The component owning us.
|
||||
/// </summary>
|
||||
IInventoryComponent Owner { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.Server.Interfaces.GameObjects
|
||||
{
|
||||
public interface IItemComponent : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The inventory slot this item is stored in, if any.
|
||||
/// </summary>
|
||||
IInventorySlot ContainingSlot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the item is removed from its inventory slot.
|
||||
/// </summary>
|
||||
void RemovedFromSlot();
|
||||
|
||||
/// <summary>
|
||||
/// Called when the item is inserted into a new inventory slot.
|
||||
/// </summary>
|
||||
void EquippedToSlot(IInventorySlot slot);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user