Fixed world clock: no player time controls (ISS-117)
CI / build + unit + e2e (pull_request) Failing after 12m10s
CI / build + unit + e2e (pull_request) Failing after 12m10s
The world always runs at WORLD_TIME_SCALE = 24 (lib/worldClock.ts). A server
background tick (instrumentation.ts -> startBackgroundTick, 1 s interval)
advances the sim with no open browser; idle-pause freezes the clock exactly
while no plane is flying or in repair. Fresh worlds start year 2000
(STARTING_CLOCK_MS in seed.ts).
- Removed: POST /api/sim + OpenAPI entry, applyTimeControls/clampTimeScale,
lib/timeScale.ts, LeftPane pause button + scale slider machinery,
ISS-057 slow-on-landing/resume in flyPlane.
- Snapshot simState is now { clockMs } only; client extrapolates at the fixed
rate between polls and freezes while idle (useSimClock).
- New test-only hook POST /api/test/set-timescale behind FLIGHT_TEST_HOOKS=1
(sibling of set-health); all e2e setScale helpers call it, afterEach restores
the world rate. E2E pause tests replaced by idle-pause assertions; sim.spec.ts
activates the world via set-health + /repair for advance/expiry tests.
This commit is contained in:
+13
-7
@@ -1,4 +1,5 @@
|
||||
import { haversineKm } from '@/lib/geo';
|
||||
import { WORLD_TIME_SCALE } from '@/lib/worldClock';
|
||||
import { PLANE_TYPES, repRate, STARTER_MODEL } from './catalog';
|
||||
import { pickSpecial, SPECIALS } from './specials';
|
||||
|
||||
@@ -75,6 +76,10 @@ export interface SeedData {
|
||||
export const STARTING_CASH = 20_000;
|
||||
export const STARTING_REPUTATION = 10;
|
||||
|
||||
// ISS-117 (v0.52.0): fresh worlds start at the top of year 2000 — a fixed game-time origin so
|
||||
// every new save begins from the same moment. Existing saves keep their own clock (no migration).
|
||||
export const STARTING_CLOCK_MS = Date.UTC(2000, 0, 1);
|
||||
|
||||
// The starter plane grounds at a large central-European hub. If the ICAO is
|
||||
// ever missing from the dataset we fall back to the first airport rather than
|
||||
// failing first run. (EDDF = Frankfurt; EDDM is Munich — don't mix them up.)
|
||||
@@ -291,20 +296,21 @@ export function buildSeed(input: {
|
||||
|
||||
const count = PACKAGE_COUNT_MIN + Math.floor(rng() * (PACKAGE_COUNT_MAX - PACKAGE_COUNT_MIN + 1));
|
||||
// Stable index-based ids for the seed set; runtime-generated entities must use
|
||||
// random UUIDs to avoid colliding with these.
|
||||
// random UUIDs to avoid colliding with these. Deadlines are drawn relative to the GAME clock
|
||||
// origin (ISS-117), not the real wall time, so they stay meaningful at the fixed world rate.
|
||||
const packages: SeedPackage[] = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
packages.push(generatePackage({ id: `package-${i + 1}`, airports, rng, nowMs }));
|
||||
packages.push(generatePackage({ id: `package-${i + 1}`, airports, rng, nowMs: STARTING_CLOCK_MS }));
|
||||
}
|
||||
|
||||
return {
|
||||
plane,
|
||||
packages,
|
||||
account: { cash: STARTING_CASH, reputation: STARTING_REPUTATION },
|
||||
// lastRealTickMs starts at the seed moment so the first tick-on-read advances
|
||||
// by ~0 instead of treating "time since install" as elapsed play time.
|
||||
// lastSelectedTimeScale (v0.30.0, ISS-057) mirrors the seeded speed — nothing has been
|
||||
// selected manually yet, so resume would restore 1× anyway.
|
||||
simState: { clockMs: nowMs, timeScale: 1, paused: false, lastRealTickMs: nowMs, lastSelectedTimeScale: 1 },
|
||||
// ISS-117 (v0.52.0): the game clock starts at year 2000 with the fixed world rate; lastRealTickMs
|
||||
// is the REAL seed moment so the first tick advances by ~0 instead of treating "time since
|
||||
// install" as elapsed play time. paused/lastSelectedTimeScale are legacy columns kept for schema
|
||||
// stability — no game code reads them anymore.
|
||||
simState: { clockMs: STARTING_CLOCK_MS, timeScale: WORLD_TIME_SCALE, paused: false, lastRealTickMs: nowMs, lastSelectedTimeScale: WORLD_TIME_SCALE },
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user