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

@@ -69,6 +69,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="GameObjects\Components\Inventory\ClientInventoryComponent.cs" />
<Compile Include="GameObjects\Components\Storage\ClientStorageComponent.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GameObjects\Components\Items\ClientHandsComponent.cs" />

View File

@@ -13,7 +13,6 @@ namespace Content.Client
{
var factory = IoCManager.Resolve<IComponentFactory>();
factory.RegisterIgnore("Inventory");
factory.RegisterIgnore("Item");
factory.RegisterIgnore("Interactable");
factory.RegisterIgnore("Damageable");
@@ -38,12 +37,14 @@ namespace Content.Client
factory.RegisterIgnore("MeleeWeapon");
factory.RegisterIgnore("Storeable");
factory.RegisterIgnore("Clothing");
factory.Register<HandsComponent>();
factory.RegisterReference<HandsComponent, IHandsComponent>();
factory.Register<ClientStorageComponent>();
factory.Register<ClientDoorComponent>();
factory.Register<ClientInventoryComponent>();
}
}
}

View File

@@ -0,0 +1,231 @@
using Content.Shared.GameObjects;
using SS14.Client.GameObjects;
using SS14.Client.UserInterface;
using SS14.Client.UserInterface.Controls;
using SS14.Client.UserInterface.CustomControls;
using SS14.Shared.ContentPack;
using SS14.Shared.GameObjects;
using SS14.Shared.GameObjects.Serialization;
using SS14.Shared.Input;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using System;
using System.Collections.Generic;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventoryMessage;
using static Content.Shared.GameObjects.SharedInventoryComponent.ServerInventoryMessage;
namespace Content.Client.GameObjects
{
public class ClientInventoryComponent : SharedInventoryComponent
{
private InventoryWindow Window;
private string TemplateName = "HumanInventory"; //stored for serialization purposes
public event EventHandler<BoundKeyChangedMessage> OnCharacterMenuKey;
public override void ExposeData(EntitySerializer serializer)
{
base.ExposeData(serializer);
Window = new InventoryWindow(this);
serializer.DataField(ref TemplateName, "Template", "HumanInventory");
Window.CreateInventory(TemplateName);
}
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
{
switch (message)
{
//Updates what we are storing in UI slots
case ServerInventoryMessage msg:
if (msg.Updatetype == ServerInventoryUpdate.Addition)
{
Window.AddToSlot(msg);
}
else if (msg.Updatetype == ServerInventoryUpdate.Removal)
{
Window.RemoveFromSlot(msg);
}
break;
}
}
/// <summary>
/// Register a hotkey to open the character menu with
/// </summary>
public override void Initialize()
{
base.Initialize();
OnCharacterMenuKey += OpenMenu;
IoCManager.Resolve<IEntityManager>().SubscribeEvent<BoundKeyChangedMessage>(OnCharacterMenuKey, this);
}
/// <summary>
/// Hotkey opens the character menu window
/// </summary>
/// <param name="sender"></param>
/// <param name="message"></param>
private void OpenMenu(object sender, BoundKeyChangedMessage message)
{
if(message.Function == BoundKeyFunctions.OpenCharacterMenu && message.State == BoundKeyState.Down)
{
Window.AddToScreen();
Window.Open();
}
}
public void SendUnequipMessage(Slots slot)
{
var unequipmessage = new ClientInventoryMessage(slot, ClientInventoryUpdate.Unequip);
SendNetworkMessage(unequipmessage);
}
public void SendEquipMessage(Slots slot)
{
var equipmessage = new ClientInventoryMessage(slot, ClientInventoryUpdate.Equip);
SendNetworkMessage(equipmessage);
}
/// <summary>
/// Temporary window to hold the basis for inventory hud
/// </summary>
private class InventoryWindow : SS14Window
{
private int elements_x;
private GridContainer GridContainer;
private List<Slots> IndexedSlots;
private Dictionary<Slots, InventoryButton> InventorySlots = new Dictionary<Slots, InventoryButton>(); //ordered dictionary?
private ClientInventoryComponent InventoryComponent;
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Inventory/HumanInventory.tscn");
public InventoryWindow(ClientInventoryComponent inventory)
{
InventoryComponent = inventory;
HideOnClose = true;
}
/// <summary>
/// Creates a grid container filled with slot buttons loaded from an inventory template
/// </summary>
/// <param name="TemplateName"></param>
public void CreateInventory(string TemplateName)
{
Type type = AppDomain.CurrentDomain.GetAssemblyByName("Content.Shared").GetType("Content.Shared.GameObjects." + TemplateName);
Inventory inventory = (Inventory)Activator.CreateInstance(type);
elements_x = inventory.Columns;
GridContainer = (GridContainer)Contents.GetChild("PanelContainer").GetChild("CenterContainer").GetChild("GridContainer");
GridContainer.Columns = elements_x;
IndexedSlots = new List<Slots>(inventory.SlotMasks);
foreach(Slots slot in IndexedSlots)
{
InventoryButton newbutton = new InventoryButton(slot);
if (slot == Slots.NONE)
{
//TODO: Re-enable when godot grid container maintains grid with invisible elements
//newbutton.Visible = false;
}
else
{
//Store slot button and give it the default onpress behavior for empty elements
newbutton.GetChild<Button>("Button").OnPressed += AddToInventory;
InventorySlots.Add(slot, newbutton);
}
if (SlotNames.ContainsKey(slot))
{
newbutton.GetChild<Button>("Button").Text = SlotNames[slot];
}
GridContainer.AddChild(newbutton);
}
}
/// <summary>
/// Adds the item we have equipped to the slot texture and prepares the slot button for removal
/// </summary>
/// <param name="message"></param>
public void AddToSlot(ServerInventoryMessage message)
{
InventoryButton button = InventorySlots[message.Inventoryslot];
var entity = IoCManager.Resolve<IEntityManager>().GetEntity(message.EntityUid);
button.EntityUid = message.EntityUid;
var container = button.GetChild("CenterContainer");
button.GetChild<Button>("Button").OnPressed += RemoveFromInventory;
button.GetChild<Button>("Button").OnPressed -= AddToInventory;
//Gets entity sprite and assigns it to button texture
if (entity.TryGetComponent(out SpriteComponent sprite))
{
var tex = sprite.CurrentSprite;
var rect = button.GetChild("CenterContainer").GetChild<TextureRect>("TextureRect");
if (tex != null)
{
rect.Texture = tex;
rect.Scale = new Vector2(Math.Min(CalculateMinimumSize().X, 32) / tex.Height, Math.Min(CalculateMinimumSize().Y, 32) / tex.Height);
}
else
{
throw new NotImplementedException();
}
}
}
/// <summary>
/// Remove element from the UI and update its button to blank texture and prepare for insertion again
/// </summary>
/// <param name="message"></param>
public void RemoveFromSlot(ServerInventoryMessage message)
{
InventoryButton button = InventorySlots[message.Inventoryslot];
button.GetChild("CenterContainer").GetChild<TextureRect>("TextureRect").Texture = null;
button.EntityUid = EntityUid.Invalid;
button.GetChild<Button>("Button").OnPressed -= RemoveFromInventory;
button.GetChild<Button>("Button").OnPressed += AddToInventory;
}
private void RemoveFromInventory(BaseButton.ButtonEventArgs args)
{
args.Button.Pressed = false;
var control = (InventoryButton)args.Button.Parent;
InventoryComponent.SendUnequipMessage(control.Slot);
}
private void AddToInventory(BaseButton.ButtonEventArgs args)
{
args.Button.Pressed = false;
var control = (InventoryButton)args.Button.Parent;
InventoryComponent.SendEquipMessage(control.Slot);
}
}
private class InventoryButton : Control
{
public Slots Slot;
public EntityUid EntityUid;
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Inventory/StorageSlot.tscn");
public InventoryButton(Slots slot)
{
Slot = slot;
}
}
}
}

View File

@@ -60,7 +60,10 @@ namespace Content.Client.GameObjects
public void UseActiveHand()
{
SendNetworkMessage(new ActivateInhandMsg());
if(GetEntity(ActiveIndex) != null)
{
SendNetworkMessage(new ActivateInhandMsg());
}
}
}
}

View File

@@ -74,8 +74,10 @@
<Compile Include="GameObjects\Components\Interactable\Tools\WelderComponent.cs" />
<Compile Include="GameObjects\Components\Interactable\Tools\WirecutterComponent.cs" />
<Compile Include="GameObjects\Components\Interactable\Tools\WrenchComponent.cs" />
<Compile Include="GameObjects\Components\Items\Clothing\ClothingComponent.cs" />
<Compile Include="GameObjects\Components\Items\Storage\StoreableComponent.cs" />
<Compile Include="GameObjects\Components\Items\Storage\ServerStorageComponent.cs" />
<Compile Include="GameObjects\Components\Items\Storage\ItemComponent.cs" />
<Compile Include="GameObjects\Components\Power\PowerStorageComponent.cs" />
<Compile Include="GameObjects\Components\Power\PowerGeneratorComponent.cs" />
<Compile Include="GameObjects\Components\Power\PowerDevice.cs" />
@@ -88,14 +90,12 @@
<Compile Include="GameObjects\Components\Weapon\Ranged\Hitscan\HitscanWeaponComponent.cs" />
<Compile Include="GameObjects\Components\Weapon\Ranged\Projectile\ProjectileWeapon.cs" />
<Compile Include="GameObjects\Components\Weapon\Ranged\RangedWeapon.cs" />
<Compile Include="GameObjects\ContainerSlot.cs" />
<Compile Include="GameObjects\EntitySystems\InteractionSystem.cs" />
<Compile Include="GameObjects\EntitySystems\PowerSystem.cs" />
<Compile Include="Interfaces\GameObjects\Components\Items\IHandsComponent.cs" />
<Compile Include="Interfaces\GameObjects\Components\Items\IInventoryComponent.cs" />
<Compile Include="Interfaces\GameObjects\Components\Items\IItemComponent.cs" />
<Compile Include="GameObjects\Components\Items\ServerHandsComponent.cs" />
<Compile Include="GameObjects\Components\Items\InventoryComponent.cs" />
<Compile Include="GameObjects\Components\Items\Storage\ItemComponent.cs" />
<Compile Include="GameObjects\Components\GUI\ServerHandsComponent.cs" />
<Compile Include="GameObjects\Components\GUI\InventoryComponent.cs" />
<Compile Include="GameObjects\Components\Damage\DamageableComponent.cs" />
<Compile Include="GameObjects\Components\Damage\DestructibleComponent.cs" />
<Compile Include="GameObjects\Components\Damage\ResistanceSet.cs" />

View File

@@ -53,12 +53,12 @@ namespace Content.Server
factory.RegisterReference<HandsComponent, IHandsComponent>();
factory.Register<InventoryComponent>();
factory.RegisterReference<InventoryComponent, IInventoryComponent>();
factory.Register<StoreableComponent>();
factory.Register<ItemComponent>();
factory.RegisterReference<ItemComponent, IItemComponent>();
factory.RegisterReference<ItemComponent, StoreableComponent>();
factory.Register<ClothingComponent>();
factory.RegisterReference<ClothingComponent, ItemComponent>();
factory.Register<DamageableComponent>();
factory.Register<DestructibleComponent>();

View File

@@ -0,0 +1,273 @@
using SS14.Server.GameObjects;
using SS14.Server.GameObjects.Components.Container;
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network;
using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventoryMessage;
using static Content.Shared.GameObjects.SharedInventoryComponent.ServerInventoryMessage;
using SS14.Shared.IoC;
using SS14.Server.Interfaces.Player;
using SS14.Shared.GameObjects.Serialization;
using SS14.Shared.ContentPack;
namespace Content.Server.GameObjects
{
public class InventoryComponent : SharedInventoryComponent
{
private Dictionary<Slots, ContainerSlot> SlotContainers = new Dictionary<Slots, ContainerSlot>();
string TemplateName = "HumanInventory"; //stored for serialization purposes
public override void ExposeData(EntitySerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref TemplateName, "Template", "HumanInventory");
CreateInventory(TemplateName);
}
private void CreateInventory(string TemplateName)
{
Type type = AppDomain.CurrentDomain.GetAssemblyByName("Content.Shared").GetType("Content.Shared.GameObjects." + TemplateName);
Inventory inventory = (Inventory)Activator.CreateInstance(type);
foreach (Slots slotnames in inventory.SlotMasks)
{
if(slotnames != Slots.NONE)
{
var newslot = AddSlot(slotnames);
}
}
}
public override void OnRemove()
{
foreach (var slot in SlotContainers.Keys)
{
RemoveSlot(slot);
}
base.OnRemove();
}
/// <summary>
/// Helper to get container name for specified slot on this component
/// </summary>
/// <param name="slot"></param>
/// <returns></returns>
private string GetSlotString(Slots slot)
{
return Name + "_" + Enum.GetName(typeof(Slots), slot);
}
/// <summary>
/// Gets the clothing equipped to 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>
public ItemComponent GetSlotItem(Slots slot)
{
return SlotContainers[slot].ContainedEntity?.GetComponent<ItemComponent>();
}
/// <summary>
/// Equips slothing to the specified 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="clothing">The item to insert into the slot.</param>
/// <returns>True if the item was successfully inserted, false otherwise.</returns>
public bool Equip(Slots slot, ClothingComponent clothing)
{
if (clothing == null)
{
throw new ArgumentNullException(nameof(clothing), "Clothing must be passed here. To remove some clothing from a slot, use Unequip()");
}
if(clothing.SlotFlags == SlotFlags.PREVENTEQUIP //Flag to prevent equipping at all
|| (clothing.SlotFlags & SlotMasks[slot]) == 0) //Does the clothing flag have any of our requested slot flags
{
return false;
}
var inventorySlot = SlotContainers[slot];
if (!inventorySlot.Insert(clothing.Owner))
{
return false;
}
clothing.EquippedToSlot(inventorySlot);
var UIupdatemessage = new ServerInventoryMessage()
{
Inventoryslot = slot,
EntityUid = clothing.Owner.Uid,
Updatetype = ServerInventoryUpdate.Addition
};
SendNetworkMessage(UIupdatemessage);
return true;
}
/// <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>
public bool CanEquip(Slots slot, ClothingComponent item)
{
return SlotContainers[slot].CanInsert(item.Owner);
}
/// <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>
public bool Unequip(Slots slot)
{
if (!CanUnequip(slot))
{
return false;
}
var inventorySlot = SlotContainers[slot];
var item = inventorySlot.ContainedEntity.GetComponent<ItemComponent>();
if (!inventorySlot.Remove(inventorySlot.ContainedEntity))
{
return false;
}
var UIupdatemessage = new ServerInventoryMessage()
{
Inventoryslot = slot,
EntityUid = item.Owner.Uid,
Updatetype = ServerInventoryUpdate.Removal
};
SendNetworkMessage(UIupdatemessage);
item.RemovedFromSlot();
// TODO: The item should be dropped to the container our owner is in, if any.
var itemTransform = item.Owner.GetComponent<TransformComponent>();
itemTransform.LocalPosition = Owner.GetComponent<TransformComponent>().LocalPosition;
return true;
}
/// <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>
public bool CanUnequip(Slots slot)
{
var InventorySlot = SlotContainers[slot];
return InventorySlot.ContainedEntity != null && InventorySlot.CanRemove(InventorySlot.ContainedEntity);
}
/// <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>
public ContainerSlot AddSlot(Slots slot)
{
if (HasSlot(slot))
{
throw new InvalidOperationException($"Slot '{slot}' already exists.");
}
return SlotContainers[slot] = ContainerManagerComponent.Create<ContainerSlot>(GetSlotString(slot), Owner);
}
/// <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>
public void RemoveSlot(Slots slot)
{
if (!HasSlot(slot))
{
throw new InvalidOperationException($"Slow '{slot}' does not exist.");
}
if (GetSlotItem(slot) != null && !Unequip(slot))
{
// TODO: Handle this potential failiure better.
throw new InvalidOperationException("Unable to remove slot as the contained clothing could not be dropped");
}
SlotContainers.Remove(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>
public bool HasSlot(Slots slot)
{
return SlotContainers.ContainsKey(slot);
}
/// <summary>
/// Message that tells us to equip or unequip items from the inventory slots
/// </summary>
/// <param name="msg"></param>
private void HandleInventoryMessage(ClientInventoryMessage msg)
{
if (msg.Updatetype == ClientInventoryUpdate.Equip)
{
var hands = Owner.GetComponent<HandsComponent>();
var activehand = hands.GetActiveHand;
if (activehand != null && activehand.Owner.TryGetComponent(out ClothingComponent clothing))
{
hands.Drop(hands.ActiveIndex);
if(!Equip(msg.Inventoryslot, clothing))
{
hands.PutInHand(clothing);
}
}
}
else if (msg.Updatetype == ClientInventoryUpdate.Unequip)
{
var hands = Owner.GetComponent<HandsComponent>();
var activehand = hands.GetActiveHand;
var itemcontainedinslot = GetSlotItem(msg.Inventoryslot);
if (activehand == null && itemcontainedinslot != null && Unequip(msg.Inventoryslot))
{
hands.PutInHand(itemcontainedinslot);
}
}
}
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
{
base.HandleMessage(message, netChannel, component);
switch(message)
{
case ClientInventoryMessage msg:
var playerMan = IoCManager.Resolve<IPlayerManager>();
var session = playerMan.GetSessionByChannel(netChannel);
var playerentity = session.AttachedEntity;
if (playerentity == Owner)
HandleInventoryMessage(msg);
break;
}
}
}
}

View File

@@ -3,15 +3,15 @@ using System.Collections.Generic;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects;
using SS14.Server.Interfaces.GameObjects;
using SS14.Server.GameObjects;
using SS14.Server.GameObjects.Components.Container;
using SS14.Server.Interfaces.Player;
using SS14.Shared.GameObjects;
using SS14.Shared.GameObjects.Serialization;
using SS14.Shared.Input;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.IoC;
using SS14.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects
{
@@ -33,60 +33,41 @@ namespace Content.Server.GameObjects
}
}
private Dictionary<string, IInventorySlot> hands = new Dictionary<string, IInventorySlot>();
private Dictionary<string, ContainerSlot> hands = new Dictionary<string, ContainerSlot>();
private List<string> orderedHands = new List<string>();
private IInventoryComponent inventory;
private IServerTransformComponent transform;
private YamlMappingNode tempParametersMapping;
// Mostly arbitrary.
public const float PICKUP_RANGE = 2;
public override void Initialize()
public override void ExposeData(EntitySerializer serializer)
{
inventory = Owner.GetComponent<IInventoryComponent>();
transform = Owner.GetComponent<IServerTransformComponent>();
if (tempParametersMapping != null)
base.ExposeData(serializer);
serializer.DataField(ref orderedHands, "hands", new List<string>(0));
foreach (var handsname in orderedHands)
{
foreach (var node in tempParametersMapping.GetNode<YamlSequenceNode>("hands"))
{
AddHand(node.AsString());
}
AddHand(handsname);
}
base.Initialize();
}
public override void OnRemove()
{
inventory = null;
base.OnRemove();
}
public override void LoadParameters(YamlMappingNode mapping)
{
tempParametersMapping = mapping;
base.LoadParameters(mapping);
}
public IEnumerable<IItemComponent> GetAllHeldItems()
public IEnumerable<ItemComponent> GetAllHeldItems()
{
foreach (var slot in hands.Values)
{
if (slot.Item != null)
if (slot.ContainedEntity != null)
{
yield return slot.Item;
yield return slot.ContainedEntity.GetComponent<ItemComponent>();
}
}
}
public IItemComponent GetHand(string index)
public ItemComponent GetHand(string index)
{
var slot = hands[index];
return slot.Item;
return slot.ContainedEntity?.GetComponent<ItemComponent>();
}
public IItemComponent GetActiveHand => GetHand(ActiveIndex);
public ItemComponent GetActiveHand => GetHand(ActiveIndex);
/// <summary>
/// Enumerates over the hand keys, returning the active hand first.
@@ -105,7 +86,7 @@ namespace Content.Server.GameObjects
}
}
public bool PutInHand(IItemComponent item)
public bool PutInHand(ItemComponent item)
{
foreach (var hand in ActivePriorityEnumerable())
{
@@ -118,7 +99,7 @@ namespace Content.Server.GameObjects
return false;
}
public bool PutInHand(IItemComponent item, string index, bool fallback = true)
public bool PutInHand(ItemComponent item, string index, bool fallback = true)
{
if (!CanPutInHand(item, index))
{
@@ -126,10 +107,10 @@ namespace Content.Server.GameObjects
}
var slot = hands[index];
return slot.Owner.Insert(slot.Name, item);
return slot.Insert(item.Owner);
}
public bool CanPutInHand(IItemComponent item)
public bool CanPutInHand(ItemComponent item)
{
foreach (var hand in ActivePriorityEnumerable())
{
@@ -142,27 +123,50 @@ namespace Content.Server.GameObjects
return false;
}
public bool CanPutInHand(IItemComponent item, string index)
public bool CanPutInHand(ItemComponent item, string index)
{
var slot = hands[index];
return slot.Owner.CanInsert(slot.Name, item);
return slot.CanInsert(item.Owner);
}
public bool Drop(string index)
/// <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>
public bool Drop(string slot)
{
if (!CanDrop(index))
if (!CanDrop(slot))
{
return false;
}
var slot = hands[index];
return slot.Owner.Drop(slot.Name);
var inventorySlot = hands[slot];
var item = inventorySlot.ContainedEntity.GetComponent<ItemComponent>();
if (!inventorySlot.Remove(inventorySlot.ContainedEntity))
{
return false;
}
item.RemovedFromSlot();
// TODO: The item should be dropped to the container our owner is in, if any.
var itemTransform = item.Owner.GetComponent<TransformComponent>();
itemTransform.LocalPosition = Owner.GetComponent<TransformComponent>().LocalPosition;
return true;
}
public bool CanDrop(string index)
/// <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>
public bool CanDrop(string slot)
{
var slot = hands[index];
return slot.Item != null && slot.Owner.CanDrop(slot.Name);
var inventorySlot = hands[slot];
return inventorySlot.CanRemove(inventorySlot.ContainedEntity);
}
public void AddHand(string index)
@@ -172,9 +176,12 @@ namespace Content.Server.GameObjects
throw new InvalidOperationException($"Hand '{index}' already exists.");
}
var slot = inventory.AddSlot(HandSlotName(index));
var slot = ContainerManagerComponent.Create<ContainerSlot>(Name + "_" + index, Owner);
hands[index] = slot;
orderedHands.Add(index);
if(!orderedHands.Contains(index))
{
orderedHands.Add(index);
}
if (ActiveIndex == null)
{
ActiveIndex = index;
@@ -188,7 +195,7 @@ namespace Content.Server.GameObjects
throw new InvalidOperationException($"Hand '{index}' does not exist.");
}
inventory.RemoveSlot(HandSlotName(index));
hands[index].Shutdown(); //TODO verify this
hands.Remove(index);
orderedHands.Remove(index);
@@ -220,9 +227,9 @@ namespace Content.Server.GameObjects
var dict = new Dictionary<string, EntityUid>(hands.Count);
foreach (var hand in hands)
{
if (hand.Value.Item != null)
if (hand.Value.ContainedEntity != null)
{
dict[hand.Key] = hand.Value.Item.Owner.Uid;
dict[hand.Key] = hand.Value.ContainedEntity.Uid;
}
}
return new HandsComponentState(dict, ActiveIndex);
@@ -239,6 +246,7 @@ namespace Content.Server.GameObjects
ActiveIndex = orderedHands[index];
}
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
{
@@ -271,7 +279,7 @@ namespace Content.Server.GameObjects
break;
}
//Boundkeychangedmsg only works for the player entity
//Boundkeychangedmsg only works for the player entity and doesn't need any extra verification
case BoundKeyChangedMsg msg:
if (msg.State != BoundKeyState.Down)
return;

View File

@@ -0,0 +1,29 @@
using SS14.Shared.GameObjects.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
namespace Content.Server.GameObjects
{
public class ClothingComponent : ItemComponent
{
public override string Name => "Clothing";
public SlotFlags SlotFlags = SlotFlags.PREVENTEQUIP; //Different from None, NONE allows equips if no slot flags are required
private List<string> slotstrings = new List<string>(); //serialization
public override void ExposeData(EntitySerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref slotstrings, "Slots", new List<string>(0));
foreach(var slotflagsloaded in slotstrings)
{
SlotFlags |= (SlotFlags)Enum.Parse(typeof(SlotFlags), slotflagsloaded.ToUpper());
}
}
}
}

View File

@@ -1,167 +0,0 @@
using Content.Server.Interfaces.GameObjects;
using SS14.Server.GameObjects;
using SS14.Server.GameObjects.Components.Container;
using SS14.Server.Interfaces.GameObjects;
using SS14.Shared.Utility;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using System;
using System.Collections.Generic;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects
{
public class InventoryComponent : Component, IInventoryComponent
{
public override string Name => "Inventory";
private Dictionary<string, InventorySlot> slots = new Dictionary<string, InventorySlot>();
private TransformComponent transform;
// TODO: Make this container unique per-slot.
private IContainer container;
public override void Initialize()
{
transform = Owner.GetComponent<TransformComponent>();
container = Container.Create("inventory", Owner);
base.Initialize();
}
public override void OnRemove()
{
foreach (var slot in slots.Keys)
{
RemoveSlot(slot);
}
transform = null;
container = null;
base.OnRemove();
}
public override void LoadParameters(YamlMappingNode mapping)
{
if (mapping.TryGetNode<YamlSequenceNode>("slots", out var slotsNode))
{
foreach (var node in slotsNode)
{
AddSlot(node.AsString());
}
}
base.LoadParameters(mapping);
}
public IItemComponent Get(string slot)
{
return _GetSlot(slot).Item;
}
public IInventorySlot GetSlot(string slot)
{
return slots[slot];
}
// Private version that returns our concrete implementation.
private InventorySlot _GetSlot(string slot)
{
return slots[slot];
}
public bool Insert(string slot, IItemComponent item)
{
if (item == null)
{
throw new ArgumentNullException(nameof(item), "An item must be passed. To remove an item from a slot, use Drop()");
}
var inventorySlot = _GetSlot(slot);
if (!CanInsert(slot, item) || !container.Insert(item.Owner))
{
return false;
}
inventorySlot.Item = item;
item.EquippedToSlot(inventorySlot);
return true;
}
public bool CanInsert(string slot, IItemComponent item)
{
var inventorySlot = _GetSlot(slot);
return inventorySlot.Item == null && container.CanInsert(item.Owner);
}
public bool Drop(string slot)
{
if (!CanDrop(slot))
{
return false;
}
var inventorySlot = _GetSlot(slot);
var item = inventorySlot.Item;
if (!container.Remove(item.Owner))
{
return false;
}
item.RemovedFromSlot();
inventorySlot.Item = null;
// TODO: The item should be dropped to the container our owner is in, if any.
var itemTransform = item.Owner.GetComponent<TransformComponent>();
itemTransform.LocalPosition = transform.LocalPosition;
return true;
}
public bool CanDrop(string slot)
{
var inventorySlot = _GetSlot(slot);
var item = inventorySlot.Item;
return item != null && container.CanRemove(item.Owner);
}
public IInventorySlot AddSlot(string slot)
{
if (HasSlot(slot))
{
throw new InvalidOperationException($"Slot '{slot}' already exists.");
}
return slots[slot] = new InventorySlot(slot, this);
}
public void RemoveSlot(string slot)
{
if (!HasSlot(slot))
{
throw new InvalidOperationException($"Slow '{slot}' does not exist.");
}
if (Get(slot) != null && !Drop(slot))
{
// TODO: Handle this potential failiure better.
throw new InvalidOperationException("Unable to remove slot as the contained item could not be dropped");
}
slots.Remove(slot);
}
public bool HasSlot(string slot)
{
return slots.ContainsKey(slot);
}
private class InventorySlot : IInventorySlot
{
public IItemComponent Item { get; set; }
public string Name { get; }
public IInventoryComponent Owner { get; }
public InventorySlot(string name, IInventoryComponent owner)
{
Name = name;
Owner = owner;
}
}
}
}

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

View File

@@ -0,0 +1,51 @@
using SS14.Server.GameObjects.Components.Container;
using SS14.Server.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Content.Server.GameObjects
{
public class ContainerSlot : BaseContainer
{
public IEntity ContainedEntity { get; private set; } = null;
/// <inheritdoc />
public override IReadOnlyCollection<IEntity> ContainedEntities => new List<IEntity> { ContainedEntity }.AsReadOnly();
public ContainerSlot(string id, IContainerManager manager) : base(id, manager)
{
}
/// <inheritdoc />
public override bool CanInsert(IEntity toinsert)
{
if (ContainedEntity != null)
return false;
return base.CanInsert(toinsert);
}
/// <inheritdoc />
public override bool Contains(IEntity contained)
{
if (contained == ContainedEntity)
return true;
return false;
}
/// <inheritdoc />
protected override void InternalInsert(IEntity toinsert)
{
ContainedEntity = toinsert;
}
/// <inheritdoc />
protected override void InternalRemove(IEntity toremove)
{
ContainedEntity = null;
}
}
}

View File

@@ -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.

View File

@@ -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; }
}
}

View File

@@ -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);
}
}

View File

@@ -65,6 +65,9 @@
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="GameObjects\Components\Doors\SharedDoorComponent.cs" />
<Compile Include="GameObjects\Components\Inventory\EquipmentSlotDefinitions.cs" />
<Compile Include="GameObjects\Components\Inventory\InventoryTemplates.cs" />
<Compile Include="GameObjects\Components\Inventory\SharedInventoryComponent.cs" />
<Compile Include="GameObjects\Components\Storage\SharedStorageComponent.cs" />
<Compile Include="GameObjects\ContentNetIDs.cs" />
<Compile Include="GameObjects\PhysicalConstants.cs" />

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>

View File

@@ -9,5 +9,6 @@
public const uint HANDS = 1003;
public const uint DOOR = 1004;
public const uint STORAGE = 1005;
public const uint INVENTORY = 1006;
}
}

View File

@@ -1,21 +1,160 @@
- type: entity
parent: BaseItem
name: "Clothing"
id: Clothing
components:
- type: Transform
- type: Clothing
Size: 5
- type: Clickable
- type: BoundingBox
- type: Physics
mass: 5
- type: entity
parent: Clothing
id: ShoesItem
name: Shoes
components:
- type: Sprite
sprite: Items/shoes.png
- type: Icon
icon: Items/shoes.png
- type: Clothing
Slots:
- shoes
- type: entity
parent: BaseItem
id: JanitorUniformItem
parent: Clothing
id: JanitorUniform
name: Janitor Jumpsuit
components:
- type: Sprite
sprite: Items/janitorsuit.png
- type: Icon
icon: Items/janitorsuit.png
- type: Clothing
Slots:
- innerclothing
- type: entity
parent: Clothing
id: SecurityVestClothing
name: Security Vest
components:
- type: Sprite
sprite: Clothing/armorvest.png
- type: Icon
icon: Clothing/armorvest.png
- type: Clothing
Slots:
- outerclothing
- type: entity
parent: Clothing
id: UtilityBeltClothing
name: Utility Belt
components:
- type: Sprite
sprite: Clothing/belt_utility.png
- type: Icon
icon: Clothing/belt_utility.png
Size: 30
- type: Clothing
Slots:
- belt
- type: Storage
Capacity: 30
- type: entity
parent: Clothing
id: BackpackClothing
name: Backpack
components:
- type: Sprite
sprite: Clothing/backpack.png
- type: Icon
icon: Clothing/backpack.png
Size: 9999
- type: Clothing
Slots:
- back
- type: Storage
Capacity: 100
- type: entity
parent: Clothing
id: MesonGlasses
name: Mesons
components:
- type: Sprite
sprite: Clothing/glasses_meson.png
- type: Icon
icon: Clothing/glasses_meson.png
- type: Clothing
Slots:
- eyes
- type: entity
parent: Clothing
id: YellowGloves
name: Insulated Gloves
components:
- type: Sprite
sprite: Clothing/gloves_yellow.png
- type: Icon
icon: Clothing/gloves_yellow.png
- type: Clothing
Slots:
- gloves
- type: entity
parent: Clothing
id: HelmetSecurity
name: Security Helmet
components:
- type: Sprite
sprite: Clothing/helmet_sec.png
- type: Icon
icon: Clothing/helmet_sec.png
- type: Clothing
Slots:
- head
- type: entity
parent: Clothing
id: GasMaskClothing
name: Gas Mask
components:
- type: Sprite
sprite: Clothing/gasmask.png
- type: Icon
icon: Clothing/gasmask.png
- type: Clothing
Slots:
- mask
- type: entity
parent: Clothing
id: IDCardStandard
name: Identification Card
components:
- type: Sprite
sprite: Clothing/idcard_standard.png
- type: Icon
icon: Clothing/idcard_standard.png
- type: Clothing
Slots:
- idcard
- type: entity
parent: Clothing
id: RadioHeadsetEars
name: Headset Radio
components:
- type: Sprite
sprite: Clothing/ears_headset.png
- type: Icon
icon: Clothing/ears_headset.png
- type: Clothing
Slots:
- ears

View File

@@ -0,0 +1,79 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scenes/SS14Window/SS14Window.tscn" type="PackedScene" id=1]
[node name="SS14Window" index="0" instance=ExtResource( 1 )]
margin_right = 403.0
rect_clip_content = false
[node name="Contents" parent="." index="0"]
rect_clip_content = false
[node name="PanelContainer" type="PanelContainer" parent="Contents" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
_sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Mouse", "Rect", "Size Flags", "Theme" ]
[node name="CenterContainer" type="CenterContainer" parent="Contents/PanelContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 7.0
margin_top = 7.0
margin_right = 276.0
margin_bottom = 424.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
use_top_left = false
_sections_unfolded = [ "Anchor", "Focus", "Grow Direction", "Hint", "Margin", "Mouse", "Rect", "Size Flags", "Theme" ]
[node name="GridContainer" type="GridContainer" parent="Contents/PanelContainer/CenterContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 134.0
margin_top = 208.0
margin_right = 134.0
margin_bottom = 208.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
columns = 3
_sections_unfolded = [ "Anchor", "Focus", "Grow Direction", "Hint", "Margin", "Material", "Mouse", "Rect", "Size Flags", "Theme", "custom_constants" ]
[node name="Header" parent="." index="1"]
rect_clip_content = false
[node name="Header Text" parent="Header" index="0"]
rect_clip_content = false
text = "I dont how to not use a window"
[node name="CloseButton" parent="Header" index="1"]
rect_clip_content = false

View File

@@ -0,0 +1,31 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = -1.0
content_margin_right = -1.0
content_margin_top = -1.0
content_margin_bottom = -1.0
bg_color = Color( 0.746094, 0.0320587, 0.0320587, 0.519333 )
draw_center = true
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.8, 0.8, 0.8, 1 )
border_blend = false
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2
corner_detail = 8
expand_margin_left = 0.0
expand_margin_right = 0.0
expand_margin_top = 0.0
expand_margin_bottom = 0.0
shadow_color = Color( 0, 0, 0, 0.6 )
shadow_size = 0
anti_aliasing = false
anti_aliasing_size = 1
_sections_unfolded = [ "Anti Aliasing", "Border", "Border Width", "Corner Radius", "Expand Margin", "Shadow" ]

View File

@@ -0,0 +1,89 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scenes/Inventory/StorageSlot.tres" type="StyleBox" id=1]
[node name="PanelContainer" type="PanelContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -974.0
margin_bottom = -550.0
rect_min_size = Vector2( 50, 50 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
custom_styles/panel = ExtResource( 1 )
_sections_unfolded = [ "Anchor", "Focus", "Grow Direction", "Hint", "Material", "Mouse", "Rect", "Visibility", "custom_styles" ]
[node name="Button" type="Button" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 1.0
margin_top = 1.0
margin_right = 49.0
margin_bottom = 49.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
action_mode = 0
enabled_focus_mode = 2
shortcut = null
group = null
text = "Slut"
flat = true
clip_text = true
align = 1
_sections_unfolded = [ "Anchor", "Focus", "Grow Direction", "Hint", "Margin", "Mouse", "Rect", "Size Flags", "Theme", "custom_colors", "custom_constants", "custom_fonts", "custom_styles" ]
[node name="CenterContainer" type="CenterContainer" parent="." index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 1.0
margin_top = 1.0
margin_right = 49.0
margin_bottom = 49.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
use_top_left = false
_sections_unfolded = [ "Mouse" ]
[node name="TextureRect" type="TextureRect" parent="CenterContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 24.0
margin_top = 24.0
margin_right = 24.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
stretch_mode = 0
_sections_unfolded = [ "Mouse" ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

2
engine

Submodule engine updated: 32caf088ef...3a78a26652