Inventory
Overview
All Out provides a player inventory API that allows you to create items, give them to players, and for players to arrange, use, and drop items in your game.
There are three core concepts:
Item definitions (
Item_Definition): what an item is (name/icon/stacking + your own fields)Item instances (
Item_Instance): an actual stack in the world/in an inventoryInventories (
Inventory): a container of slots that holds item instances
Every player has a built-in inventory at player.default_inventory.
Persistence
If you'd like player inventories to be automatically saved across game sessions, enable the Auto Save Player Inventory box in the Edit → Game Config section of the editor.

You can also configure these settings programmatically in CSL. Call Scene.set_auto_save_player_inventory(true) and Scene.set_player_inventory_capacity(32) during scene initialisation (e.g. in ao_before_scene_load) before any players join.
Inventory API reference
Quick start (register + give an item)
Register item definitions once in ao_before_scene_load, then create instances and move them into a player’s inventory.
Displaying the hotbar
To show the standard inventory hotbar UI on screen, call Items.draw_hotbar inside your Player's ao_late_update method. Without it, the inventory system works behind the scenes but the player won't see it!
Items.draw_hotbar handles the entire hotbar + bag toggle UI for you. It returns a Draw_Hotbar_Result with selected_item, selected_item_index, inventory_open, and dropped_item fields.
hide_bag_button = true prevents the player from opening the backpack. If the backpack is already open, it will close, so only use it when players still have another way to access important items.
Checking if a player already has an item
A common pattern is to give an item only if the player doesn't already have one:
Use the definition's registered ID:
You can also check how much room is left for a specific item type before creating it:
Custom Inventories
You can create inventories that aren’t tied to a player, for things like:
Chests / storage containers
Fish/mob teams
To access items:
Atomic item moves
Use a transaction when several item moves must either all succeed or all fail:
Each item instance may appear only once in the transaction. Always call can_move_all_items first; move_all_items asserts if the complete transaction no longer fits. A move can merge a stack and destroy the moved instance, so do not keep using item references after the transaction.
Dropped Items
If you want players to drop items into the world (and let other players pick them up), use the dropped items system:
Spawning a dropped item
Drop animation + snapping to navmesh
Handling drag-drop from the hotbar UI
If you use Items.draw_hotbar, players can drag an item out of the UI to drop it. Dropped_Item.handle_dropped_item removes it from the inventory and spawns a dropped item entity.
Dropped items automatically despawn over time (with a warning bar). Holding the interact button on an item resets its despawn timer.
You can make a dropped item exclusive (only visible/pickable by one player) using dropped.set_exclusive(player).
Last updated