expressobits / inventory-system

Modular inventory system for godot 4 with nodes, compatible with multiplayer, separate logic from the UI, Using items as separate resources.
MIT License
459 stars 31 forks source link

Items and inventory with Grid #35

Open scriptsengineer opened 1 year ago

scriptsengineer commented 1 year ago

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? 🤔

Cleptomania commented 11 months ago

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

scriptsengineer commented 11 months ago

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?

benjamin-kirkbride commented 11 months ago

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

scriptsengineer commented 11 months ago

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

benjamin-kirkbride commented 11 months ago

Perhaps we try to emulate this: https://github.com/peter-kish/gloot/blob/master/docs/inventory_grid.md