[Request] Simpler ways to work with inventory from Verse

Currently, a custom inventory management device can be created from a combination of Item Granters, Item Removers, and Conditional Buttons to detect what player currently has.

This ends up being rather complicated and inefficient (given the number of devices) and does not give control over some operations such as the order of items (which is important, for example, if you are building a custom extended inventory).

Suggestion: GetInventory() on agent that could return something like this:

# Not sure on code licensing in forums, but my intention is for code below
# to be under public domain/CC0, please feel free to use in any way.

agent_inventory := interface:
    GetSlots(): []inventory_slot

    AddItemToSlot(Index: int, Item: creative_item_asset, ?Amount: int = 1, <# some optional args managing what to do if there is an existing item in slot #>)<decides>:void

    AddItem(Item: creative_item_asset, ?Amount: int = 1, <# some optional args managing what to do if no space for it, or if item is already owned #>)<decides>:void

    RemoveItemFromSlot(Index: int, ?Amount: int, <# some optional args managing whether to drop the item or just destroy it #>)<decides>:void

    RemoveItem(Item: creative_item_asset, ?Amount: int, <# some optional args managing whether to drop the items or just destroy them #>)<decides>:void

    RemoveAllItems():void

inventory_slot := interface:
    Index: int
    Item: ?creative_item_asset
    IsSelected: logic   

# where creative_item_asset some kind of item representation (ideally with a string id or code that allows built-in ones to be identified or compared)

@djpixel Thank you for your feedback. While I cannot guarantee a response, I can confirm that this has been forwarded to the appropriate team.

1 Like

I agree. This would be great.

1 Like

lego has a pretty typical inventory, which now handles sorting and stacking - so it’s clearly there… just a shame we dont get to test it yet :frowning: