user card Hand becomes the action surface, the board shows the train, and a reverse stops turning it around, other bug fixes too.

This commit is contained in:
Jesse
2026-08-05 19:18:26 -04:00
parent 1c321d4cea
commit 543584a2ca
20 changed files with 1851 additions and 320 deletions
+43
View File
@@ -901,3 +901,46 @@ describe('a turnout may be laid to face another, making a crossover', () => {
assert.ok(!has(dests, -1, 0), 'and may not stop on the turnout itself');
});
});
// ---------------------------------------------------------------------------
describe('backing up does not turn the train around', () => {
it('keeps the engine pointing the same way through a reverse move', () => {
// REPORTED as forward/reverse being scrambled. `facing` is which way the ENGINE points, and it
// was reset to the direction of travel on EVERY move — so one reverse move silently spun the
// train about, everything read "forward" again, and a run-around became pointless: you could
// change ends for free by backing up twice.
const s = gameWith(
areaFrom(
{
[coordKey(at(0, 0))]: straight(),
[coordKey(at(0, 1))]: straight(),
[coordKey(at(0, 2))]: straight(),
},
at(0, 5),
),
);
const id = 'crew';
s.trays.set(id, {
id, trainNumber: null, trainIsExtra: false, engineAt: 0,
consist: [], direction: 'east', facing: 'e',
position: { at: 'grid', owner: 0, coord: at(0, 1) }, movesUsed: 0,
} as never);
s.clock.phase = 'localOps';
s.clock.currentActor = 0;
s.turn.option = 'switch';
s.turn.movesRemaining = 6;
// Running forward, east: the engine leads, so it still points east.
assert.ok(applyIntent(s, 0, { type: 'switch.move', trayId: id, to: at(0, 2), reverse: false }).ok);
assert.equal(s.trays.get(id)!.facing, 'e', 'a forward move must leave the engine leading');
// Backing up, west: the engine trails. It is still pointing east.
assert.ok(applyIntent(s, 0, { type: 'switch.move', trayId: id, to: at(0, 0), reverse: true }).ok);
assert.equal(
s.trays.get(id)!.facing,
'e',
'backing up turned the train around — a run-around would then be pointless',
);
});
});