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

Creating new items does not refresh the ID cache by creating items on top of each other. #58

Closed scriptsengineer closed 1 year ago

scriptsengineer commented 1 year ago

I believed this line: database.items.append(item)

It would call the "set" of the database items variable, but it doesn't call.

@export var items : Array[InventoryItem] = []:
    set(new_items):
        items = new_items
        update_items_cache()
    get:
        return items
scriptsengineer commented 1 year ago

Confirming this was my mistake, I'll update to forcibly call cache refresh after adding new items/categories https://github.com/godotengine/godot/issues/17310

scriptsengineer commented 1 year ago

Fixed with 3cd7b296220c93a48a9fae53f67f7aac526a359b