Appearance
Items and slots
Keep an item's definition separate from the quantity held in a slot. This makes both the implementation and its documentation easier to follow.
Core concepts
| Concept | Meaning | Example |
|---|---|---|
| Item ID | A stable key for an item type. | health_potion |
| Display name | The text shown in the interface. | Health Potion |
| Quantity | The number of items in a slot. | 3 |
| Stack limit | The maximum quantity per slot. | 5 |
| Capacity | The number of inventory slots. | 4 |
Adding items
In this example, the suggested workflow first checks matching stacks with available space. If quantity remains, it looks for empty slots. The result should clearly report when there is not enough space.
text
Validate the quantity
→ Find matching stacks
→ Check empty slots
→ Report the result
→ Update the viewData and the interface
Inventory data represents the result of an operation. The interface displays that result. An icon appearing in a slot does not, on its own, prove that an item was successfully added to the data.
Design choice: partial additions
If there is room for only 3 out of 10 items, an implementation may add 3 or reject the entire operation. A real product guide should explain which behavior it uses, what result it returns, and what quantity remains in the world.
Return to the quick start to try the scenario again.