fix tracks to all be EW. no more NS tracks

This commit is contained in:
Jesse
2026-08-05 01:00:11 -04:00
parent 821d3cdffa
commit 2d348e1ecf
16 changed files with 1157 additions and 355 deletions
+22 -14
View File
@@ -48,39 +48,47 @@ export type RollingStock = { type: CarType; loaded: boolean };
* A turnout's handedness: the stem is §A.1's "A", the two legs are "B" and "C". The rule that
* matters is that `through` and `diverge` are NOT joined to each other.
*
* OPEN (Gap 11) — the rules specify "turnout ×6" without saying how many face which way. Until
* that is settled, orientation is carried per card and defaults to stem-east / diverge-north.
* The through track is ALWAYS east-west (`{stem, through}` is `{e,w}`); the diverging leg is the
* 45° one and always reaches north or south. Which of the two the card can be turned to is decided
* by its printed handedness — see `Slope`.
*/
export type TurnoutOrientation = { stem: 'n' | 's' | 'e' | 'w'; through: 'n' | 's' | 'e' | 'w'; diverge: 'n' | 's' | 'e' | 'w' };
/**
* A straight card's axis. Also part of Gap 11 — the catalogue says "straight ×3" without saying
* how many run each way, yet a layout with no north-south straight can never use the Office's
* junction stubs at all.
*/
/**
* A curve joins two ADJACENT edges. There are exactly four such arcs, and a card can be turned to
* any of them — which is what makes a siding possible: an arc reaching NORTH is the only way back
* up to the Running Track from the district below.
* A curve joins two ADJACENT edges: it runs along the card's centre line from the east or west edge
* to a frog, then leaves at 45° through the MIDDLE of the north or south edge. Four such arcs
* exist, but a printed card reaches only two of them (`Slope`).
*/
export type TrackArc = 'ne' | 'nw' | 'se' | 'sw';
export type TrackAxis = 'ew' | 'ns';
/**
* WHICH DIAGONAL A 45° LEG LIES ON.
*
* The printed cards (docs/tracks.png) put the through rail dead centre and send every diverging leg
* out at 45° through the middle of the north or south edge. A card can be turned 180° but not
* flipped over, so its leg never changes diagonal: the slope is printed, not chosen.
*
* Each name is the pair of arcs that MATE across a horizontal card edge — an `sw` card sitting
* above an `ne` card is one unbroken rail, whereas `sw` above `nw` is a V and joins nothing. That
* is the whole matching rule, and it is why the name is spelt this way.
*
* On screen `ne_sw` descends to the right and `nw_se` descends to the left.
*/
export type Slope = 'ne_sw' | 'nw_se';
export type CardGeometry =
| {
kind: 'track';
geometry: TrackGeometry;
turnout?: TurnoutOrientation;
axis?: TrackAxis;
/** Which two edges a CURVE joins — chosen on placement, since the card can be turned. */
arc?: TrackArc;
/** Curves are printed left- or right-handed (design supply); not chosen on placement. */
/** Curves and turnouts are printed left- or right-handed, which fixes their `Slope`. */
hand?: 'left' | 'right';
}
| { kind: 'office' }
| { kind: 'limits' }
| { kind: 'facility'; facility: FreightKind; axis?: TrackAxis }
| { kind: 'facility'; facility: FreightKind }
/** Not track — a Modifier sits beside a Facility and raises its capacity (§9). */
| { kind: 'modifier'; modifier: ModifierKind }
/** Not track — a Space-use card played at a district to consume a cell (Q6). */