Repository navigation
Edit coaster track from a selected piece - #194
Conversation
Select any placed piece (click its rails in the track tool, or Edit from this piece in the ride window), step with Previous/Next piece, then demolish that piece or build from its open end. Removing a middle piece splits the track into sections instead of refusing; placements join any open end and close the circuit once one ring remains. Track edits are refused while the ride is open, testing, has a train out or riders aboard. Removing a station detaches a stranded entrance or exit. Co-authored-by: Nori <contact@tilework.tech>
🤖 Generated with [Nori](https://noriagentic.com) Co-Authored-By: Nori <contact@tilework.tech>
🤖 Generated with [Nori](https://noriagentic.com) Co-Authored-By: Nori <contact@tilework.tech>
…; first piece of a new coaster may go beside other track 🤖 Generated with [Nori](https://noriagentic.com) Co-Authored-By: Nori <contact@tilework.tech>
… renderers, desktop and Pixel 8) Co-authored-by: Nori <contact@tilework.tech>
Proof: before and after (I checked every image myself)All files are in the proofs branch at commit Before (main)In the track tool, a click on a middle rail only says the circuit is complete. Demolish last piece removes the end piece and reports "Track piece placed." After, WebGL2 desktop, closed circuitThe clicked middle piece (7 of 14) is outlined, and nothing on the track changed: After, stacked track, rotation and the other renderer and devices
|
Co-authored-by: Nori <contact@tilework.tech>
|
Live verification on https://opencoaster.noriagentic.com/ after #194 and the follow-up fix #195 (Previous piece now works on a closed circuit when nothing is selected). Pages deploy runs: https://github.com/tilework-tech/opencoaster/actions/runs/41431840467 and https://github.com/tilework-tech/opencoaster/actions/runs/41436435967 (both succeeded). Captures: https://github.com/tilework-tech/opencoaster/tree/8721b28da2d09e0df204d4416b850d1a159ca0d9/pr-194/live |






Summary
🤖 Generated with Nori
Players can now pick any piece of a coaster and edit from there. Before, the only option was to demolish from the last piece.
Selected piece N of M · <shape>. Selecting changes nothing on the track.How it works
src/sim/track/construction.ts):closedis set only when everything forms a single ring.head/tailtrack the section being built, soremoveTrack -1and the cursor behave as before.trackLinks(id, prev, next per track row).pieceIdandcoasterPart.pickTrackPiecehit-tests coaster sprites only, by alpha and topmost first. Both Canvas2D and WebGL2 use the same pick targets, so rotation, stacked track and multi-tile pieces resolve to the visible piece.Behaviour references (described in
docs/mechanics/track.md§2.8; original code, clean-room)Test Plan
pnpm lint,pnpm format:check,pnpm typecheck,pnpm test(all pass locally).track-editing.test.ts,track-edit-safety.test.ts):e2e/track-edit-selection.spec.ts, WebGL2 and Canvas2D × desktop and Pixel 8 touch, 8/8 passing. Two flows:pnpm e2e:quick: 12 passed. 2context-menutests failed with Chromium "Target crashed"; the same crash happens on main's code in this environment.starter-ride-access,ride-access-reproanduniversal-clearancehappen identically on main's code here (tile-coordinate calibration and timeouts). They are not caused by this PR, and CI does not run them.pnpm e2e(329 tests, one worker, this machine): 173 passed, 116 failed, 40 skipped. I reran all 116 failures with main's code (--last-failed) and 115 failed the same way, so they come from this environment (Chromium crashes, coordinate calibration, guest spawning, art), not from this PR. The one difference wasstall-storefront"explains a stall whose window faces no footpath". It failed once and then passed on this branch, so it is flaky. None of the 8 new track-edit tests failed.Proof (before/after screenshots): see the PR comment.
Requested in Nori: https://demo.norisessions.com/chat/01a16c13-c814-7295-9955-b11ff875ed14
Share Nori with your team: https://www.npmjs.com/package/nori-skillsets