[rust] T5-1 farm_basic: Travel->Fight->Heal->Repeat example (#17) #36
Loading…
Reference in a new issue
No description provided.
Delete branch "task/17-farm-basic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #17. New examples/farm_basic crate: full farming loop over on_tick_async — Travel (waypoint legs, new_map retry), Fight (target acquisition, cooldown handling, kill ledger), Heal (potion gate at 40% hp), death -> auto_respawn -> re-plan. 10-min acceptance run: 26 crab kills, level 9->16 (7 level-ups), 38 potions, 0 deaths, exit 0. Live test (90s, Clinker, #[ignore]): green.
Review: CHANGES_REQUESTED. Verified good: layering (no crates/* change), cooldown/heal-gate/targeting correct, routes+spawns+mob stats independently confirmed, 39 offline tests + 1 correctly-gated live test, no secrets in logs.
Blocking:
Non-blocking: delete never-called Zone::from_env (lib.rs:296-310; misleading doc at lib.rs:968); the Event::GameLog auto-respawn arm (lib.rs:1581-1583) can never fire (the SDK sends that line only to the sink, never as an Event) - remove it and fix the two-doors doc at lib.rs:1576-1579; rebase onto current main (it advanced to
ba5cea3), which fixes the PLAN.md diff that un-ticks #17 and reverts #16's in-progress marker.bee4e88e17698f49cf24Two live findings from re-running the acceptance farm, and the review's non-blocking list. **Ground truth, not geometry.** `Zone::verified_ground` was a geometric predicate over hand-verified corridors and the farm margin, and it was too narrow: a character standing at (24.7, 196.5) — in the middle of town, on ground the server walks on every day — logged `off verified ground, and the way back is further than one leg` and sat there. The new `ground` module reads the digest of the table the server actually consults (`node/precomputed_map_data.js`'s `smap_data.main`, via `data/main_walkable_rows.txt`), cell for cell, with `smap_round`'s own truncation spelled out. Walking is a lattice question, so it is answered off the lattice: `walkable_path` is a bounded breadth-first search over walkable cells and `travel` now distinguishes *ground* ("may we stand here") from *road* ("does standing here say where to step next"), and routes to the road instead of reporting itself stranded. The 691,896-point audit compares every read of the crate's predicate against an independently parsed copy of the table and reports 0 disagreements; the direction that can cost a jail cell — the crate accepting a point the server rejects — fails the test at its first instance. **A bar we cannot pay with is a bar that needs a drink.** A level-16 warrior pays 3 mp a swing and the server refuses an unaffordable one outright (`no_mp`, `node/server.js:3076`), so a run with an empty bar banks `attacks=0 kills=0` and exits 0. `decide` now opens the `Heal` gate on mp as well as hp, and does so on the server's own `no_mp` as well as on a ratio — the ratio floors are the SDK ladder's two mp rungs (0.5 / 0.75) rather than numbers this crate invented, because the floor does not choose the potion, the ladder does, and a gate that wants a drink below a line the ladder does not drink below sits in `Heal` listening to itself answer `Full`. **Dead at login never wakes up.** `Game::auto_respawn` is armed by a death *edge*; a character already dead when the window opens produces none, and the crate spent a real 90 s in `Wait("dead — waiting for auto-respawn")`, refused every action as `disabled`, and exited 0. After the server's own 12 s `rip_time` grace the crate asks for the respawn itself, on a tick budget so `decide` stays pure, and counts the death it never saw so the summary cannot read `deaths=0 respawns=1`. Review nits: `Zone::from_env` is gone (reading the environment is `RuntimeEnv`'s job, once), and the `Event::GameLog` respawn arm is gone — the SDK's "auto-respawn" line goes to the log sink and never becomes an event, so that door could not fire. Offline: 50 tests. `bash rust/dev/check.sh` green.4cf8bde1ccecb43a600a