Slow to 1× on landing + resume last selected speed (ISS-057, v0.30.0) #61

Merged
kamilkrzywda merged 1 commits from feat/slow-resume-time-scale into master 2026-09-20 22:43:27 +02:00
Owner

What changed (ISS-057 — replace pause-on-landing with slow/resume)

New behavior: instead of pausing the sim when a plane lands, it now slows to 1× on any landing (a just-landed plane is grounded, so any real landing triggers it; pure auto-chain ticks where nothing grounds do not). When a dispatch takes the last grounded plane airborne, the sim resumes the player's last manually selected speed. A manual speed change updates that resume target ("unless changed manually" — last intent wins, no extra flag). Pause remains a manual-only control; dispatch still unpauses.

Implementation:

  • New persisted column sim_state.last_selected_time_scale (schema + DDL + guarded ALTER migration with one-shot backfill from current time_scale; seed default 1).
  • lib/sim/engine.ts: tickOnce landing block → slow to MIN_TIME_SCALE when ≥1 landed this tick and any plane is 'available'; applyTimeControls writes lastSelectedTimeScale only when a timeScale is posted (paused-only posts untouched).
  • lib/game/actions.ts flyPlane: keeps the paused:false write; after dispatch, if zero 'available' planes remain → timeScale = lastSelectedTimeScale.
  • No snapshot/OpenAPI/route/client changes — slider and label re-read timeScale from each poll.

Tests

  • Unit: pause-on-landing describe rewritten to 5 slow/resume cases; dispatch test → 2 resume cases; +1 sim-route test (timeScale post updates lastSelected, paused-only does not); seed exact-equality gains the field; legacy-migration fixture asserts backfill. vitest 327 passed in 32 files (was 325).
  • E2E: e2e/pause-on-landing.spec.ts renamed to e2e/slow-on-landing.spec.ts, rewritten — landing asserts paused===false && timeScale===1; dispatch snapshot asserts resume to the last selected scale. Other specs' setScale helpers unchanged.

Replaces the v0.24.0 pause-on-landing behavior per ISS-057.

## What changed (ISS-057 — replace pause-on-landing with slow/resume) **New behavior:** instead of pausing the sim when a plane lands, it now **slows to 1×** on any landing (a just-landed plane is grounded, so any real landing triggers it; pure auto-chain ticks where nothing grounds do not). When a dispatch takes the **last grounded plane airborne**, the sim resumes the player's **last manually selected speed**. A manual speed change updates that resume target ("unless changed manually" — last intent wins, no extra flag). Pause remains a manual-only control; dispatch still unpauses. **Implementation:** - New persisted column `sim_state.last_selected_time_scale` (schema + DDL + guarded ALTER migration with one-shot backfill from current `time_scale`; seed default 1). - `lib/sim/engine.ts`: tickOnce landing block → slow to `MIN_TIME_SCALE` when ≥1 landed this tick and any plane is `'available'`; `applyTimeControls` writes `lastSelectedTimeScale` only when a timeScale is posted (paused-only posts untouched). - `lib/game/actions.ts` flyPlane: keeps the `paused:false` write; after dispatch, if zero `'available'` planes remain → `timeScale = lastSelectedTimeScale`. - No snapshot/OpenAPI/route/client changes — slider and label re-read timeScale from each poll. ## Tests - Unit: pause-on-landing describe rewritten to 5 slow/resume cases; dispatch test → 2 resume cases; +1 sim-route test (timeScale post updates lastSelected, paused-only does not); seed exact-equality gains the field; legacy-migration fixture asserts backfill. vitest **327 passed** in 32 files (was 325). - E2E: `e2e/pause-on-landing.spec.ts` renamed to `e2e/slow-on-landing.spec.ts`, rewritten — landing asserts `paused===false && timeScale===1`; dispatch snapshot asserts resume to the last selected scale. Other specs' setScale helpers unchanged. Replaces the v0.24.0 pause-on-landing behavior per ISS-057.
kamilkrzywda added 1 commit 2026-09-20 22:34:27 +02:00
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-20 22:34:41 +02:00
kamilkrzywda merged commit 57cc6705f2 into master 2026-09-20 22:43:27 +02:00
kamilkrzywda deleted branch feat/slow-resume-time-scale 2026-09-20 22:43:27 +02:00
Sign in to join this conversation.