Joins follow the travel direction: the next piece goes right after the end (t67 phase 2b)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+21
-19
@@ -118,15 +118,17 @@ dist/, shots/ build output and screenshots (not committed)
|
||||
- kind `mold`.
|
||||
`hidden` pieces are not in the menu. The menu's tabs and order are `BUILD_CATS` in
|
||||
`src/ui/build-menu.js`.
|
||||
- **Transport geometry:** `joins.js` owns geometric ends and joins for belts, filters and screws.
|
||||
`pieceEnds(code, v)` returns precomputed left/right ends (vertical screws: up/down).
|
||||
`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 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.
|
||||
- **Transport geometry:** `joins.js` owns travel-directed ends and mutual joins for belts,
|
||||
filters and screws. `pieceEnds(code, v)` returns precomputed geometric left/right ends
|
||||
(vertical screws: up/down), with travel and inlet/outlet roles. `endJoin(bx, by, endIndex,
|
||||
planned = null)` returns `neighbourBlock * 2 + neighbourEnd`, or -1; `pieceJoins` returns
|
||||
bits 0/1. Plans override world blocks, including the queried block. Outlets target the next
|
||||
block along travel, with the belt surface exceptions. Inlet ties prefer same-shape travel,
|
||||
then top-to-bottom, left-to-right; a join must be reciprocal. Both looks, ghosts, previews,
|
||||
diagonal screw grain/bar transfers and straight screw entry into diagonals share this rule.
|
||||
Flat-belt bar entry uses `entBeltScrewEnter` and the swept-path collision check. Straight
|
||||
screw side-feeding into lifts remains independent. Edge elbows bend inside the
|
||||
diagonal; diagonal outlets bend inside the receiving straight block.
|
||||
- **Placing and removing:**
|
||||
- `placeBlock` / `removeBlock` (`blocks.js`);
|
||||
- `placeMachineAt` / `addMachine` / `removeMachine` (`actions.js`, `machines.js`);
|
||||
@@ -274,12 +276,12 @@ Pipes, pumps and outlets: each joined line holds one liquid as a count, not as g
|
||||
Per-tick machine work: steam engines, fans, belts, filters, screw conveyors (machinesTick).
|
||||
- functions: engineIntake, fanBlow, machinesTick
|
||||
|
||||
### src/sim/joins.js (71 lines)
|
||||
Geometric transport ends. Tables are built once; querying a world or plan allocates nothing. Ends are left/right, except vertical screws (up/down). Travel direction is irrelevant.
|
||||
### src/sim/joins.js (73 lines)
|
||||
Travel-directed transport ends. Precomputed probes; world/plan queries allocate nothing. End indices stay geometric: left/right, or up/down for vertical screws.
|
||||
- functions: pieceEnds, joinCandidate, endJoin, pieceJoins
|
||||
- variables: JOIN_ENDS
|
||||
|
||||
### src/sim/conveyors.js (223 lines)
|
||||
### src/sim/conveyors.js (211 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, screwAccepts, straightScrewNext, diagonalScrewNext
|
||||
- variables: CARRY_DEPTH, filterR, filterL, filtersDirty
|
||||
@@ -298,9 +300,9 @@ 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 (307 lines)
|
||||
### src/sim/items.js (317 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
|
||||
- functions: entSolidCell, entSupportCount, entFreeAt, entMark, spawnBar, removeEnt, entScrewAt, entScrewFree, entScrewMove, entScrewLane, entScrewEdge, entScrewEnter, entScrewTick, entDiagonalScrewTick, entBeltScrewEnter, entSlopeBeltTick, entTick, entsInCircle, bagAdd, bagTake, giveOrDrop, refundAt, canAfford, payCost, fmtMoney, costText, needText
|
||||
- variables: BAR_W, BAR_H, entCurM, droppedLast
|
||||
|
||||
### src/sim/tools.js (52 lines)
|
||||
@@ -376,17 +378,17 @@ Drawing (src/render/): browser only. This file: the renderer state R, colour tab
|
||||
Propagated coloured light from glowing and burning cells.
|
||||
- functions: builtForLight, looseForLight, computeLight
|
||||
|
||||
### src/render/slope-belts.js (157 lines)
|
||||
### src/render/slope-belts.js (169 lines)
|
||||
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 (78 lines)
|
||||
### src/render/diagonal-screws.js (79 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, straightScrewJoins, diagonalScrewShape, diagonalScrewBlock
|
||||
- variables: SCREW_CLASS, diagonalJoins, diagonalAcross, diagonalAlong, diagonalCap
|
||||
|
||||
### src/render/world.js (404 lines)
|
||||
### src/render/world.js (405 lines)
|
||||
Scale colour without changing the smooth-look class.
|
||||
- functions: fogColor, drawWorld
|
||||
|
||||
@@ -403,7 +405,7 @@ Smooth look: WebGL setup, texture uploads, drawing and adaptive resolution.
|
||||
- functions: smCompile, smoothAvailable, smUpload, smoothDraw, smoothPace
|
||||
- variables: SM, smBytes
|
||||
|
||||
### src/render/slope-belt-shader.js (111 lines)
|
||||
### src/render/slope-belt-shader.js (126 lines)
|
||||
Smooth slope shading, kept beside the shared CPU geometry in slope-belts.js.
|
||||
- variables: SM_SLOPE_HELPERS, SM_SLOPE_DRAW
|
||||
|
||||
@@ -582,7 +584,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/joins.js`: Travel join grid: UR/DR/DL/UL, both ends, and all three neighbouring placements. 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).
|
||||
|
||||
Reference in New Issue
Block a user