Screw conveyors join by the shared rule: low ends and verticals join in the corner block (t67 phase 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 13:30:44 -04:00
co-authored by Claude Opus 5.5
parent 198bea54da
commit fd35bf334f
14 changed files with 358 additions and 209 deletions
+15 -13
View File
@@ -123,8 +123,10 @@ dist/, shots/ build output and screenshots (not committed)
`endJoin(bx, by, endIndex, planned = null)` returns `neighbourBlock * 2 + neighbourEnd`,
or -1; `pieceJoins(bx, by, planned = null)` returns bits 0/1 for the joined ends.
Plans override world blocks, including the queried block. Continuing diagonals take priority
over elbows; a join is returned only when both ends choose each other. Belt drawing uses
this module; screw drawing and movement still use their existing rules.
over elbows; a join is returned only when both ends choose each other. Belt and screw drawing
use this module, as do diagonal screw grain and bar transfers (`diagonalScrewNext` and
`straightScrewNext`). Straight screws still feed the side of lifts. E elbows bend in the
straight end block; both looks, ghosts and previews share that geometry.
- **Placing and removing:**
- `placeBlock` / `removeBlock` (`blocks.js`);
- `placeMachineAt` / `addMachine` / `removeMachine` (`actions.js`, `machines.js`);
@@ -141,7 +143,7 @@ dist/, shots/ build output and screenshots (not committed)
- **The pixel look:**
- `drawWorld` (`src/render/world.js`) fills one pixel per grain;
- `diagonal-screws.js` shares screw join and casing geometry between pixels, smooth shading tags and previews;
- `diagonal-screws.js` derives diagonal and straight end bends from `endJoin`, sharing casing geometry between pixels, smooth shading tags, ghosts and previews;
- `computeLight` (`light.js`) adds coloured light;
- overlays (machines, molds, the bot, rain, arrows) are drawn on the 2D canvas afterwards
(`machines.js`, `overlays.js`).
@@ -277,9 +279,9 @@ Geometric transport ends. Tables are built once; querying a world or plan alloca
- functions: pieceEnds, joinCandidate, endJoin, pieceJoins
- variables: JOIN_ENDS
### src/sim/conveyors.js (198 lines)
### src/sim/conveyors.js (223 lines)
How belts, filters and screw conveyors move what is on or in them. What rests on a belt or filter rides along: the whole stack standing on the carrying surface steps one cell toward d together (belts run front of the line first, so the way ahead is clear). If a powder grain is blocked, the load above it stands still and the belt slips underneath. A filter's own material drops through it instead, unless it is already full.
- functions: conveyorStep, carryColumn, beltDrain, launchGrain, rebuildFilters, filterCarry, carryBeltsAndFilters, setFilter, filterRun, roomFor, screwSpread, screwIntake, diagonalScrewNext
- functions: conveyorStep, carryColumn, beltDrain, launchGrain, rebuildFilters, filterCarry, carryBeltsAndFilters, setFilter, filterRun, roomFor, screwSpread, screwIntake, screwAccepts, straightScrewNext, diagonalScrewNext
- variables: CARRY_DEPTH, filterR, filterL, filtersDirty
### src/sim/slope-conveyors.js (230 lines)
@@ -296,7 +298,7 @@ Molds: cavities for castings; ingot troughs empty themselves below. Removal retu
- functions: moldCellsAt, canPlaceMold, newMoldRecord, addMold, castMix, cavityState, troughState, clearCavity, moldPlugCells, rakeAbove, furnaceJunkHint, unplugMold, ejectIngot, checkMolds, moldAt, tally, collectMold, removeMold
- variables: DROSS, grains, barWord
### src/sim/items.js (288 lines)
### src/sim/items.js (307 lines)
Bars and other loose objects (ents), and the bag: adding, taking, costs and refunds.
- functions: entSolidCell, entSupportCount, entFreeAt, entMark, spawnBar, removeEnt, entScrewAt, entScrewFree, entScrewMove, entScrewLane, entScrewEdge, entScrewEnter, entScrewTick, entDiagonalScrewTick, entSlopeBeltTick, entTick, entsInCircle, bagAdd, bagTake, giveOrDrop, refundAt, canAfford, payCost, fmtMoney, costText, needText
- variables: BAR_W, BAR_H, entCurM, droppedLast
@@ -315,7 +317,7 @@ Trees (background layer), acorns, saplings, and waking freezing water.
- functions: cutTree, treeHeld, findTreeBases, treeSupportTick, woodRoom, treeFall, coldTick, plantTick, setTreeCell, saplingTick, igniteTree
- variables: treeBases, saplings, treeDraw
### src/sim/vacuum.js (179 lines)
### src/sim/vacuum.js (199 lines)
The vacuum, blowing grains out, grains in flight (flyers), and the flame tool. Material the vacuum would start on at the cursor: a bar, else the nearest loose grain.
- functions: vacuumTargetAt, toolVacuum, nozzle, toolBlow, flyOpen, depositNear, bagTemp, landFlyer, flyTick, toolIgnite
- variables: blowRR, FLY_G, FLY_Q
@@ -379,12 +381,12 @@ Drawing only: the face stays on its simulation cells; the band hangs below it.
- functions: slopeBeltConnections, flatBeltCaps, prepareSlopeBelts, slopeBeltSegment, slopeBeltCorner, slopeBeltShape, slopeBeltAt, slopeBeltColor, screenLoaded, slopeWallShape, slopeWallAt, slopeDetailAt, slopePreviewCleat
- variables: slopeBeltJoins, slopeBeltHalo, beltCaps, slopeAcross, slopeAlong, slopeDistance, slopeWallOwner
### src/render/diagonal-screws.js (68 lines)
### src/render/diagonal-screws.js (78 lines)
Screw casing geometry shared by both looks, ghosts and placement previews. smooth-look class of a screw conveyor cell by direction: 9 up, 10 right, 11 down, 12 left
- functions: diagonalScrewJoins, diagonalScrewShape, diagonalScrewBlock
- functions: diagonalScrewJoins, straightScrewJoins, diagonalScrewShape, diagonalScrewBlock
- variables: SCREW_CLASS, diagonalJoins, diagonalAcross, diagonalAlong, diagonalCap
### src/render/world.js (403 lines)
### src/render/world.js (404 lines)
Scale colour without changing the smooth-look class.
- functions: fogColor, drawWorld
@@ -405,7 +407,7 @@ Smooth look: WebGL setup, texture uploads, drawing and adaptive resolution.
Smooth slope shading, kept beside the shared CPU geometry in slope-belts.js.
- variables: SM_SLOPE_HELPERS, SM_SLOPE_DRAW
### src/render/smooth-shaders.js (370 lines)
### src/render/smooth-shaders.js (377 lines)
Smooth shaders: vertex and fragment programs for the rounded world look.
- variables: SM_VS, SM_FS
@@ -498,7 +500,7 @@ Gamepad input.
- functions: padPressed, pollPad
- variables: PAD
### src/ui/previews.js (239 lines)
### src/ui/previews.js (240 lines)
Cursor previews: shared grid helpers, air streaks and tool preview dispatch.
- functions: blockRectPx, drawGrid, previewColor, drawAirStreaks, drawReachCircle, drawPreviews, previewBlock
@@ -580,6 +582,7 @@ The frame loop and boot.
- `tools/scenes/bar-lift.js`: A mold drops copper bars onto a belt, through a screw lift and onto the upper belt.
- `tools/scenes/belt-heap.js`: A belt feeding an upward screw: sand underneath a deep heap of copper ore. Run clear-sky.js first, e.g. python3 tools/shot.py /tmp/belt-heap.png --setup tools/scenes/clear-sky.js --js "$(cat tools/scenes/belt-heap.js)" --ticks 240 --zoom 7
- `tools/scenes/clear-sky.js`: A clear work area left of the bot's starting point (the trade dock is to its right): open sky 160 grains wide and 40 tall, over a flat stone floor. Money and a bag of building stuff to build with. Sets FLOOR (the first row of the floor), BX, BY (the leftmost block of the area that stands on the floor) and CAM (the middle of the area).
- `tools/scenes/joins.js`: Shared join grid: eight rows (UR/DR/DL/UL, left/right ends), nine columns. Screw H and V, then belt H; each tries the side, above/below, and E. Self-contained, paused and empty. Use --zoom 4 --viewport 2100x1500 --no-light.
- `tools/scenes/mold-labels.js`: Run after clear-sky.js: filling, blocked, set, and hot machinery in one view.
- `tools/scenes/silo.js`: Run after clear-sky.js; leave paused so the open gate keeps its demonstration charge.
- `tools/scenes/slope-conveyors.js`: Loaded sidewall conveyor and screen. Use --js 'slopeScene(false)' (belt) or 'slopeScene(true)' (screen).
@@ -590,4 +593,3 @@ The frame loop and boot.
- `tools/scenes/t35-joins.js`: Run after clear-sky.js. Paused, empty pipes make casing, flights and mouths easy to inspect.
- `tools/scenes/t36-funnel.js`: A twelve-block funnel, one block open at the bottom, draining 400 grains of sand.
- `tools/scenes/t40-sloped-belt.js`: Self-contained: a flat feed climbs, crosses the top, and runs downhill; a filter sorts below.
- `tools/scenes/t62-joins.js`: Self-contained grid. Rows: UR, DR, DL, UL. Each run shows both ends. Columns: horizontal edge, horizontal corner, vertical edge, vertical corner. Corner columns stay unconnected, with two separate ends. Repeat those four with the straight travel reversed. Camera fits --zoom 6 --viewport 2100x1300. Run after clear-sky.js or by itself. Empty, paused screws expose the whole casing.
+19
View File
@@ -4,6 +4,25 @@ What agents have done, newest first. Add an entry for every piece of work: the d
note or request it was for, what changed, the files touched, the tests run, and anything left
open or not verified. Keep each entry short; the git history has the details.
## 2026-10-27: t67 phase 2, screw conveyors follow the join rule (Claude Code + Codex)
- Screw drawing, grain flow and bars now all go through `endJoin`. New joins: a horizontal in
E at a diagonal's low end, and a vertical in E at either end; both draw an elbow that bends
inside the straight piece's end block. Same-row high-end elbows are unchanged.
- No longer joined (moves nothing): a same-row horizontal at a low end, a vertical directly
above or below a diagonal's last block, and any other side contact. Joined belts and filters
take discharge on their carrying face at either end. A horizontal screw feeding the side of a
vertical lift still works (`straightScrewNext` keeps straight-to-straight transfers).
- The opposite-direction check is one helper, `screwAccepts`.
- Files: `src/render/diagonal-screws.js`, `src/render/smooth-shaders.js`, `src/render/world.js`,
`src/ui/previews.js`, `src/sim/conveyors.js`, `src/sim/machine-tick.js`, `src/sim/items.js`,
`src/sim/cells.js`, `tools/scenes/joins.js` (replaces `t62-joins.js`), `test/t_diag_screws.js`,
`test/t_smooth.py`, `docs/PROJECT_MAP.md`.
- Tests: `python3 test/run_all.py --browser` all passed; determinism diff changed only screw
checks. Screenshots: `shots/joins-*.png`.
- Open: inside the new elbows the flight stripes of both pieces overlap, which looks a little
busy in the smooth look. Layouts built on the removed joins need moving.
## 2026-10-27: t63 vacuum picks up grains in mid-air (Claude Code + Codex)
- `toolVacuum` now takes flyers (grains a screw launches or that were blown out) inside its