v0.4.0 — multiplayer Phases 0 and 1: seat and player split apart, turn state per player, the page behind a Session, and eight seat/player mix-ups fixed with tests that fail without them

This commit is contained in:
Jesse
2026-08-13 14:06:02 -04:00
parent 216006b091
commit 49f8504b05
34 changed files with 1743 additions and 526 deletions
+4 -4
View File
@@ -13,7 +13,7 @@ import { TOTAL_ROLLING_STOCK } from '../src/engine/content.ts';
import type { GameConfig, GameState, OfficeArea } from '../src/engine/state.ts';
import type { Intent } from '../src/engine/intents.ts';
import { connectionsFor, exitsFrom, hasPort, joins, neighbour, opposite, variantsFor } from '../src/engine/track.ts';
import { isOperationalRail } from '../src/engine/state.ts';
import { isOperationalRail, turnOf } from '../src/engine/state.ts';
import type { Port } from '../src/engine/track.ts';
import { developerBot, playGame, randomBot } from '../src/sim/bot.ts';
import { simulate } from '../src/sim/harness.ts';
@@ -97,7 +97,7 @@ describe('trains complete their runs (regression)', () => {
assert.ok(tray, `A/D track holds ${id}, which no longer exists`);
assert.equal(tray.position.at, 'grid', `${id} is recorded at an Office but is elsewhere`);
if (tray.position.at === 'grid') {
assert.equal(tray.position.owner, owner);
assert.equal(tray.position.seat, owner);
}
}
}
@@ -213,7 +213,7 @@ describe('the revenue chain works end to end (regression)', () => {
const area = s.officeAreas.get(0)!;
s.clock.phase = 'localOps';
s.clock.currentActor = 0;
s.turn.option = 'draw';
turnOf(s, 0).option = 'draw';
// A north-diverging turnout on the Running Track, and the arc that climbs to meet it. The
// column is captured BEFORE the lay: laying on the sign moves the sign outward, so reading
// `limitsEast` again afterwards names the next square along, not the turnout.
@@ -727,7 +727,7 @@ describe('the bot does not throw away its own freight (regression)', () => {
} as never);
s.clock.phase = 'localOps';
s.clock.currentActor = 0;
s.turn.option = 'freightAgent';
turnOf(s, 0).option = 'freightAgent';
const jammed = area.grid.get('-1,0')!;
assert.ok(!isOperationalRail(jammed), 'a jammed industry is not Operational Rail');