Grid Inventory
The grid inventory stores items in slots, with each item able to occupy multiple slots:
Specify collision size in the item definition.
Properties
- Each item can occupy multiple slots
- Slots can have item requirements (All collided slots' requirements must pass)
- Slots have gameplay tags
- Slots have configurable capacities (Final capacity equals the minimum among collided slots)
Requirements
Each item slot can have requirements just like the simple inventory; items that collide with multiple slots must pass requirements for all of the slots they occupy.
Capacity
Slot capacity is the minimum from among slots the item(s) occupy.
Anchors
The anchor slot stores the item's data. Other slots in the item's collision store a reference to the anchor:
The anchor is located in the top-left slot for the item's collision (the slot with minimum X and Y coordinates).
Operations and the Anchor
Inventory functions handle the anchor differently:
- Deposit: When depositing, you are specifying the anchor slot in the parameter
SlotToDeposit
. - Withdraw, Destroy, Use: You may specify any slot in the item's collision.
Saving and Loading
If you change an item's collision in between your game's release versions, items will still be in the same slots even if it looks like they shouldn't fit.