BlueGit

timfa questward

Files

questward / .cursor / rules / station-inventory.mdc

station-inventory.mdc

station-inventory.mdc 2.1 KiB Download Raw
1---
2description: Crafting station slots never hold items — bag-only until craft/brew succeeds; UI is presentation.
3alwaysApply: true
4---
5
6# Station slots are never real inventory
7
8For **all current and future** crafting stations where the player appears to put something “in” the station (furnace, anvil, cauldron, tailor, loom, benches, ovens, …):
9
10Items **do not leave the bag** into the station. Even when the UI looks like materials sit in station slots, that is **client-side presentation / soft claim only**. The server must not treat a station or tile as an item container for those mats.
11
12## Hard rules
13
14- Station/cauldron/bench “slots” are a **view or reservation over the bag**, not a second inventory.
15- Materials are **consumed only when the craft/brew successfully completes** (same moment the product is created).
16- Closing the UI, cancelling, clearing, script stop, logout, or **death mid-craft/brew** must **not** destroy reserved mats.
17- Station progress/session state is **per player**, never shared on the tile — players cannot take each other’s “station contents.”
18- On the finishing intent (`craft` complete, `bottle`, `create-dye`, …), the server **validates the bag** and then consumes; it does not trust client slot UI as ownership of items.
19
20## Forbidden
21
22```text
23# ❌ BAD — take from bag into station/session on insert or open
24onInsert(herb) { takeFromBag(herb); session.brew.push(herb); }
25onClose() { /* mats already gone, no refund */ }
26
27# ❌ BAD — tile-global station inventory
28world.tileStations[x][y].slots = [...]
29```
30
31## Required pattern
32
33```text
34# ✅ GOOD — client shows slots; server soft-tracks steps/claims only
35onInsert(herb) { assertBagHas(herb); session.pendingClaims.push(herb); /* bag unchanged */ }
36onBottle() { assertBagHas(claims); takeFromBag(claims + bottles); grantProduct(); }
37onCloseOrDeath() { clearSession(); /* bag untouched */ }
38```
39
40Recipe-only stations (no insert UI) already match this if they only deduct on successful craft completion.
41
42When adding a new station with “put items in,” default to **client-side slot UI + server bag check on commit** — never a real station inventory.