expressobits/inventory-system

Items and inventory with Grid

scriptsengineer opened this issue · 5 comments

The idea is to add an option to the item to be active if this item has grid information with X and Y and Z option (Z for an inventory that is 3D, see #32 )

Grid Inventory: Resident Evil 4 Example
image
https://store.steampowered.com/agecheck/app/254700/

Inventory should also have an option to define whether or not it is grid based
Question: The inventory and item with grid must be created class that extends the current ones or just add an option in the already existing classes? 🤔

Has there been any progress on this? Would you be open to a PR implementing this?

I had no progress, just planned, I would be interested in reviewing your PR

Has there been any progress on this? Would you be open to a PR implementing this?

@scriptsengineer could you give a brief idea of how you would approach adding this feature?

@scriptsengineer could you give a brief idea of how you would approach adding this feature?

I accept suggestions
We have two questions here:

1 - Be incremental

Initial idea was to have a GridInventory (which extends the Inventory) in which it will have a double array that indicates which slot of the base Inventory that item is pointing to
Example slot x: 1 y:0 indicates slot[1] of the base Inventory
the slot x: 1 y:1 would indicate the slot[1 + (width of grid)] of the base Inventory

2 - Items that occupy more than one slot:

I really wanted to check some examples but today I would do it like this:
If the item occupies more than one slot, the additional slot points to the main one.
Example of a 2x2 grid where the "-" indicate the same InventoryItem ID: 2 placed horizontally
[ ] [ ]
[ - ] [ - ]

the x[0] y[0] slot would place the current item information
the x[1] y[0] slot would have special information (Here I accept suggestions, in this case I marked it with an x in front of the number) indicating the continuation of an already existing item.

[ ] [ ]
[ 2 ] [ x0 ]