Exact source used by this build. SHA-256: ca36487eba1adbc1a41d1ef0e3f30631ad9f154b0067c0deaa831a0cb144a97d.
1 # Crafting, cooking and artisan implementation report
2
3 Implemented as a registered crafting simulation, content domain and client system.
4 No new runtime dependency was added. Work is uncommitted; project instructions
5 do not explicitly authorize a commit. No deployment, login, credential access,
6 push, history rewrite or deletion of pre-existing files was performed.
7
8 ## Result
9
10 - 40 crafting recipes and 20 cooking recipes, including 10 starting crafting
11 recipes and one starting cooking recipe. Skill, purchase and trusted friendship
12 mail unlocks are per player. Ingredient allocation is atomic across the backpack
13 and shared chests within three tiles, including overlapping ingredient selectors.
14 - Shared placements with footprints, collision, walkable path occupancy, owned-tool
15 pickup, three sprinkler coverage masks (4/8/24 tiles), an eight-tile scarecrow
16 mask, seeded crow attacks, three quality fertilizers and three bomb recipes.
17 - Cooking at an upgraded home landmark or a crafted cookout kit. Inventory eating
18 restores energy/health and maintains one timed food buff plus one drink buff.
19 - Four artisan machines with ten static products: keg-like, preserves-like,
20 dairy/egg processing and tree tapping. Outputs preserve the configured wine,
21 juice and preserves price formulas through ordinary inventory and sale paths.
22 Furnace recipes consume five ore and one coal for copper/iron/gold at
23 30/120/300 machine minutes; existing iridium bars also work at 480 minutes.
24 - Machine timers use the shared machine clock during play and durable, injected
25 elapsed time while everyone is absent. A virtual 24-hour offline cycle adds
26 1,600 machine minutes; the 2–6 AM segment counts 100 minutes per hour. Offline
27 calendar, crops and player buffs remain frozen. Pause also freezes machines.
28 - Phone-oriented craft/cook/object/eat panels use scrollable layouts, portrait
29 stacking, landscape sizing, and at least 44px controls. Objects have ready
30 indicators and manifest-keyed procedural placeholders.
31
32 ## Validation
33
34 Final required runs, executed by the integrating agent:
35
36 ```text
37 $ bun run check
38 163 pass
39 0 fail
40 2569 expect() calls
41 Ran 163 tests across 31 files. [46.02s]
42 Validated 13 content domains: 12 crops, 126 items, and 8 Tiled areas.
43
44 $ bun run --cwd apps/client build
45 218 modules transformed
46 build succeeded
47 JS 1,811.88 kB / gzip 443.31 kB
48 ```
49
50 Vite retains the existing warning about a bundle larger than 500 kB. The first
51 full check encountered an occupied port in the pre-existing workerd test harness;
52 a fresh-process rerun passed without stopping another task's server or changing
53 that harness. An initial direct test run needed the documented content-generation
54 step; subsequent preparation and tests passed.
55
56 Focused results: content tests 5 passed; simulation tests 24 passed; client tests
57 9 passed; real-server crafting tests 2 passed. `git diff --check` passed.
58
59 The real-server tests use two TCP WebSocket clients, production `FarmWorld`
60 authentication, reducers, journal/checkpoints and SQLite. Only Cloudflare's
61 storage/socket adapters and the wall-clock source are substituted. They verify:
62
63 1. A crafts a chest, deposits materials, and B withdraws from the same chest.
64 A crafts a machine using those nearby shared materials.
65 2. A places a sprinkler and plants; both sleep. Both see watered soil the next
66 sunny morning.
67 3. A loads preserves and a furnace; both disconnect. Three virtual days elapse,
68 `FarmWorld` is recreated from SQL, and B reconnects and collects both outputs.
69 The calendar stayed frozen; A did not receive B's collected items.
70 4. B uses the newly smelted fifth copper bar at the real town shop and completes
71 a pickaxe upgrade over three mornings. The upgraded state is persisted.
72 5. Paused offline time is discarded, and reconnect/reload cannot replay elapsed
73 machine time. The existing full suite also exercises Cloudflare's local
74 workerd transport with real WebSocket clients.
75
76 ## Shared changes and reasons
77
78 - The three system/domain registries add crafting; the simulation registry also
79 exports its public helper API. Two existing exact-list registry tests now
80 include crafting.
81 - `systems/registry.ts`, `clock.ts` and two small server call-site changes add a
82 generic `onOfflineElapsed` hook. This is necessary because the previous server
83 discarded time with no connected players; no crafting-specific server branch
84 was introduced.
85 - Inventory exposes owned helpers to add/remove a shared chest and replace its
86 slots, plus optional source-item metadata. Crafting never writes the inventory
87 system's slice directly.
88 - Farming exposes owned crop removal and fertilizer helpers, preserves fertilizer
89 metadata, and rolls seeded quality for fertilized harvests. Crows and blasts
90 therefore cannot leave stale planting metadata.
91 - Tools exposes owned debris blast handling, preserving drops without writing its
92 state slice from crafting. Tier-gated large obstacles remain tool-only.
93 - The generic optional `Tile.walkableObject` flag is carried by types and wire
94 validation. Server movement and client geometry honor it so paths reserve tiles
95 for placement/farming while remaining walkable, and machines block prediction.
96 - Asset credits include the new original procedural CC0 placeholders.
97
98 ## Known gaps and integration slots
99
100 - Browser visual QA could not run: local Chrome aborted with SIGABRT under the
101 sandbox, and computer-use exposed no browser surfaces. Phone layout is compiled
102 and interaction-tested, but screenshots and visual layout verification are absent.
103 - Fish and milk/egg inputs await their owning content producers. They are declared
104 category/tag selectors, not invented competing fish/animal IDs. Friendship mail,
105 farmhouse upgrade grants, crab-pot/bait behavior and staircase behavior have
106 typed hooks for their owning systems. Cookout cooking works independently.
107 - Buff channels, durations, health/energy restoration, maximum-energy effects and
108 bomb-defense consumption work. Other stat consumers, such as movement/combat
109 bonuses, must use the exported `activeBuffEffects`/`buffedSkillLevel` hooks.
110 - The ten artisan outputs accept the selected input IDs/tags documented in the
111 content README, not every crop/forage combination. Tapper durations use full-day
112 machine-minute equivalents rather than a separate calendar-night completion rule.
113 - Bomb damage 9/15/21 and the 2,400ms fuse are explicit configurable assumptions,
114 not verified benchmark values. The largest circular radius is seven tiles,
115 approximating the documented 6–8 extent. Bomb/buff timers are checked on the
116 existing ten-game-minute tick. Exact bomb combat parity is not claimed.
117 - Four scoped intermediate materials have craftable placeholder source recipes;
118 their identities and the late fertilizer's 20,000g purchase need reconciliation
119 with later material/vendor catalogs. Unfertilized harvest quality retains the
120 pre-existing regular-quality behavior. Fences are placed barriers; decay and
121 gate mechanics are not added here.
122
123 All creative recipe, dish, artisan product, person-reference and non-obvious
124 crafted-item names/descriptions remain `TBD`. Sixty recipe records, ten artisan
125 outputs, twenty dishes and seventy visual entries are ready for content/art
126 replacement. No dialogue, lore, flavor text or borrowed game assets were added.
127
128 See [the content contract](../../../../content/src/domains/crafting/README.md)
129 for selector APIs, input/output tables, numerical sources and content assumptions.
130 The simulation exports trusted mail, kitchen, tree and health adapters; clients
131 cannot grant themselves those privileges through an intent.
132
133 ## Changed files
134
135 ```text
136 apps/
137 client/
138 public/assets/CREDITS.md [shared]
139 src/core/registry.test.ts [shared]
140 src/systems/index.ts [shared]
141 src/systems/movement/geometry.ts [shared]
142 src/systems/crafting/{index,model,style}.ts
143 test/crafting-{model,interactions}.test.ts
144 server/
145 src/index.ts [shared]
146 test/crafting-loop.test.ts
147 packages/
148 content/
149 data/crafting/crafting.json
150 data/items/crafting.json
151 src/domains/index.ts [shared]
152 src/domains/crafting/{index,schema}.ts
153 src/domains/crafting/README.md
154 test/domains.test.ts [shared]
155 test/crafting-content.test.ts
156 sim/
157 src/{clock,protocol,types}.ts [shared]
158 src/systems/{index,registry}.ts [shared]
159 src/systems/{farming,inventory,movement,tools}/index.ts [shared]
160 src/systems/crafting/{index,model,materials,placement,machines,effects}.ts
161 src/systems/crafting/IMPLEMENTATION.md
162 test/crafting-system.test.ts
163 ```
164
165 Generated content catalogs and the approximately 1.7 MB client build remain
166 ignored. The 30 MB of reproducible state created by the completed local workerd
167 tests was removed afterward; source and pre-existing runtime inputs were retained.
168 No unusually large new generated/untracked artifact remains.
169