Pilhas, limites de peso, arrastar e largar, validado pelo servidor.
Spec — Inventory system
Status: draft · Created: 2026-11-10
1. Context and goal
Players carry, stack and move items in a grid inventory with weight limits, and the server stays the authority so items cannot be duplicated or forged.
2. Functional requirements (EARS)
- FR-1: THE SYSTEM SHALL stack identical items in one slot up to the maximum stack size defined for the item, and start a new stack beyond it.
- FR-2: THE SYSTEM SHALL compute the carried weight as the sum of item weights times their counts.
- FR-3: IF adding an item would exceed the weight limit, THEN THE SYSTEM SHALL refuse it and show how much weight is over the limit.
- FR-4: WHEN the player drags an item onto a slot, THE SYSTEM SHALL move it, merge it with a matching stack, or swap it with the item there, within one frame on the client.
- FR-5: WHEN the player drags part of a stack while holding the split modifier, THE SYSTEM SHALL split it into two stacks with the chosen counts.
- FR-6: THE SYSTEM SHALL send every inventory change to the server, which validates ownership, counts, stack size and weight before applying it.
- FR-7: IF the server rejects a change, THEN THE SYSTEM SHALL roll the client back to the server state within 200 ms of the rejection.
- FR-8: THE SYSTEM SHALL apply each change request at most once, using a request id, so retries never duplicate items.
- FR-9: THE SYSTEM SHALL record every server-side change with the player, items, counts and time.
3. Out of scope
- Trading between players.
- Crafting recipes.