Change behaviour of pausing on landing - it should pause and not change speed. While you start flight it shoud auto unpause and pause again when plane lands. #41

Closed
opened 2026-09-20 10:20:35 +02:00 by kamilkrzywda · 1 comment
Owner
No description provided.
Author
Owner

Fixed in v0.24.0.

What changed: Replaced the old "auto-slow to 1×" behavior (v0.19.0 / ISS-011) with a real pause that leaves the time scale untouched, plus an auto-resume when you start a flight.

  • lib/sim/engine.ts — when the last plane in flight lands, the sim now sets paused = true instead of resetting timeScale to 1×. The stored speed is preserved; the trigger condition (last plane in flight) and no-auto-restore semantics are unchanged.
  • lib/game/actions.ts — flyPlane() now writes sim_state.paused = false, so dispatching a flight auto-resumes a paused sim (atomic under the sim lock).

Net effect: dispatch resumes → planes fly → last landing pauses (speed kept) → next dispatch resumes again.

Tests: rewrote the auto-slow unit block for pause semantics (last landing → paused=true, scale unchanged; a landing with another plane still flying → no pause); added a flyPlane() test that dispatch on a paused sim clears paused and leaves the scale untouched. E2E: renamed auto-slow.spec.ts → pause-on-landing.spec.ts asserting simState.paused === true and timeScale === 1000 after landing, plus auto-unpause on /fly. The per-spec fast-forward helpers now also clear pause after landings.

Fixed in **v0.24.0**. **What changed:** Replaced the old "auto-slow to 1×" behavior (v0.19.0 / ISS-011) with a real **pause that leaves the time scale untouched**, plus an **auto-resume when you start a flight**. - `lib/sim/engine.ts` — when the last plane in flight lands, the sim now sets `paused = true` instead of resetting `timeScale` to 1×. The stored speed is preserved; the trigger condition (last plane in flight) and no-auto-restore semantics are unchanged. - `lib/game/actions.ts` — `flyPlane()` now writes `sim_state.paused = false`, so dispatching a flight auto-resumes a paused sim (atomic under the sim lock). Net effect: **dispatch resumes → planes fly → last landing pauses (speed kept) → next dispatch resumes again.** **Tests:** rewrote the auto-slow unit block for pause semantics (last landing → `paused=true`, scale unchanged; a landing with another plane still flying → no pause); added a `flyPlane()` test that dispatch on a paused sim clears `paused` and leaves the scale untouched. E2E: renamed `auto-slow.spec.ts` → `pause-on-landing.spec.ts` asserting `simState.paused === true` **and** `timeScale === 1000` after landing, plus auto-unpause on `/fly`. The per-spec fast-forward helpers now also clear pause after landings. - PR: #49 - Merge commit: `e109e003c024179a277f6799133a90b96d05c6d6` - Deployed: https://flight.dev.kkhost.pl (verified `/api/version` = 0.24.0, root HTTP 200)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/Flight-Ops#41