Grid Inventory (#21931)

* Grid Inventory

* oh boy we keep cracking on

* auto insertion is kinda working? gross, too!

* pieces and proper layouts

* fix the sprites

* mousing over grid pieces... finally

* dragging deez nuts all over the screen

* eek!

* dragging is 90% less horrendous

* auto-rotating

* flatten

* Rotation at last

* fix rotation and change keybind for removing items.

* rebinding and keybinding

* wow! look at that! configurable with a button! cool!

* dragging is a bit cooler, eh?

* hover insert, my beloved

* add some grids for storage, fix 1x1 storages, fix multiple inputs at once

* el navigation

* oh yeah some stuff i forgor

* more fixes and QOL stuff

* the griddening

* the last of it (yippee)

* sloth review :)
This commit is contained in:
Nemanja
2023-12-04 18:04:39 -05:00
committed by GitHub
parent 4221ed2d4b
commit cc8984d096
99 changed files with 2014 additions and 619 deletions

View File

@@ -5,6 +5,7 @@ using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
@@ -26,11 +27,16 @@ namespace Content.Shared.Storage
public Container Container = default!;
/// <summary>
/// A limit for the cumulative ItemSize weights that can be inserted in this storage.
/// If MaxSlots is not null, then this is ignored.
/// A dictionary storing each entity to its position within the storage grid.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public int MaxTotalWeight;
public Dictionary<NetEntity, ItemStorageLocation> StoredItems = new();
/// <summary>
/// A list of boxes that comprise a combined grid that determines the location that items can be stored.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public List<Box2i> Grid = new();
/// <summary>
/// The maximum size item that can be inserted into this storage,
@@ -39,12 +45,6 @@ namespace Content.Shared.Storage
[Access(typeof(SharedStorageSystem))]
public ProtoId<ItemSizePrototype>? MaxItemSize;
/// <summary>
/// The max number of entities that can be inserted into this storage.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public int? MaxSlots;
// TODO: Make area insert its own component.
[DataField("quickInsert")]
public bool QuickInsert; // Can insert storables by "attacking" them with the storage entity
@@ -94,11 +94,6 @@ namespace Content.Shared.Storage
[DataField("storageCloseSound")]
public SoundSpecifier? StorageCloseSound;
[Serializable, NetSerializable]
public sealed class StorageInsertItemMessage : BoundUserInterfaceMessage
{
}
[Serializable, NetSerializable]
public enum StorageUiKey
{
@@ -107,15 +102,54 @@ namespace Content.Shared.Storage
}
[Serializable, NetSerializable]
public sealed class StorageInteractWithItemEvent : BoundUserInterfaceMessage
public sealed class StorageInteractWithItemEvent : EntityEventArgs
{
public readonly NetEntity InteractedItemUID;
public StorageInteractWithItemEvent(NetEntity interactedItemUID)
public readonly NetEntity InteractedItemUid;
public readonly NetEntity StorageUid;
public StorageInteractWithItemEvent(NetEntity interactedItemUid, NetEntity storageUid)
{
InteractedItemUID = interactedItemUID;
InteractedItemUid = interactedItemUid;
StorageUid = storageUid;
}
}
[Serializable, NetSerializable]
public sealed class StorageSetItemLocationEvent : EntityEventArgs
{
public readonly NetEntity ItemEnt;
public readonly NetEntity StorageEnt;
public readonly ItemStorageLocation Location;
public StorageSetItemLocationEvent(NetEntity itemEnt, NetEntity storageEnt, ItemStorageLocation location)
{
ItemEnt = itemEnt;
StorageEnt = storageEnt;
Location = location;
}
}
[Serializable, NetSerializable]
public sealed class StorageInsertItemIntoLocationEvent : EntityEventArgs
{
public readonly NetEntity ItemEnt;
public readonly NetEntity StorageEnt;
public readonly ItemStorageLocation Location;
public StorageInsertItemIntoLocationEvent(NetEntity itemEnt, NetEntity storageEnt, ItemStorageLocation location)
{
ItemEnt = itemEnt;
StorageEnt = storageEnt;
Location = location;
}
}
/// <summary>
/// Network event for displaying an animation of entities flying into a storage entity
/// </summary>