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
407 stars 26 forks source link

Fix invalid main inventory access in demo #86

Closed levidavidmurray closed 8 months ago

levidavidmurray commented 8 months ago

I found this add-on today and I'm very much loving how clean and readable the code is. Amazing work! Hoping to make good use of it 🙂

I noticed the F1-F6 buttons were broken in demo, so, figured I'd tackle this to better understand the system. image

Introduced with the removal of InventoryHandler::inventory in favour of InventoryHandler::inventories last week (https://github.com/expressobits/inventory-system/commit/4b6005a397c355dc20ebd0b9d215f9275bb52529#)

InventoryHandler already has the concept of "main inventory" all over the place, but is repeatedly accessed as inventories[0]. Maybe this should be moved to a function or variable? I did notice InventoryHandler::inventory_path which is the main inventory in this specific case, but it's typed as a NodePath instead of Inventory.

✌️

scriptsengineer commented 8 months ago

I'm in the process of changing some things in the core, to get it ready for version 1.0, I really need to check some places that are strange like this inventory_handler, taking advantage, I'm currently modifying the core to receive dynamic properties of items