Files
EscapistsReintroduced/docs/mission-time.md
T

32 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Mission clock
Core owns the mission clock through `ERR_TimeService`; no companion addon is required. At successful scenario preparation, the server applies the saved start time once, enables automatic advancement, and sets the engine day duration to `86400 / timeMultiplier` seconds. The native time-and-weather manager advances and replicates the clock. The service does not set time on ticks or change the date, weather, wind or visibility.
The defaults are **14:00 and 1×** progression. An integer multiplier from **1 to 24** means one real second advances the game clock by that many seconds. Pausing the clock and separate day/night speeds are outside this implementation.
Administrators use the existing authenticated Core `/esc` command transport:
| Command | Result |
| --- | --- |
| `/esc mission time show` | Current round clock and speed, followed by the saved next-round configuration. |
| `/esc mission time set 06:15` | Save a start time for the next round. Requires exactly `HH:MM`, from `00:00` to `23:59`. |
| `/esc mission speed show` | The same current/saved clock information. |
| `/esc mission speed set 4` | Save 4× progression for the next round. Accepts integers 1–24. |
| `/esc settings` | Includes `startTimeMinutes` (0–1439) and `timeMultiplier` (1–24), along with existing settings. |
Changing either setting leaves the running round's clock and speed intact. A new mission instance uses the new values. Repeated startup calls on the same time service cannot reset the clock. A missing native manager or failed native clock configuration prevents the mission from entering the prison phase, with a preparation error; the service attempts to restore native duration/advancement if initialization fails midway.
Existing valid six-key `rereintroduced.json` files remain valid. Loading supplies 14:00/1× in memory when either newly introduced key is absent and does not rewrite the file. The next explicit successful setting save includes both new keys and preserves all six supported existing values, using the existing verified temporary-file/backup path. Present invalid new values (including fractions and out-of-range numbers) cannot silently default. Missing old required keys still invalidate the file; a valid backup is tried before preserving invalid files and using read-only defaults. Unknown JSON members continue to follow the previous loader behavior and are not retained on save.
`tools/import_settings.py` supplies clock defaults when importing the supported legacy AI/Intel settings. It does not interpret unrelated original clock settings or modify the source files.
## Validation
`python3 tests/test_time_policy.py` runs the actual Enforce parsing/formatting and duration policy bodies through the existing C++ policy harness: every minute round-trips, malformed times are rejected, clock defaults are limited to the two new keys, and multiplier boundaries produce the correct day duration. `python3 tools/check.py` covers existing policies and the expanded runtime/importer schema bounds. These policy checks do not themselves compile Enforce or validate engine behavior. The integrated native run in [040928](evidence/native-2026-09-19-040928/report.json) also passes migration, administration, no-mid-round-change and actual clock progression checks.
`ERR_NativeTimeProbe` is an authored WORKBENCH-only fixture for centralized native testing. `Run` checks isolated legacy JSON loading without a rewrite, explicit upgrade/reload, invalid or missing values, backup fallback, clock parsing, admin authorization, persistence and restoration of the test settings, native manager configuration, and unchanged current clock/speed after saved changes or repeated startup. `VerifyProgression`, called at least ten engine seconds later, compares elapsed native engine time with actual clock advancement. Neither probe opens a window. Native compilation and these scoped local checks pass in the linked run. Remote replication, multiplayer clock agreement and long-running day/night transitions remain unverified. Seven inherited vehicle resource errors still fail the overall native report.
Native API references: `ChimeraWorld.GetTimeAndWeatherManager`, and `BaseWeatherManagerEntity.SetTimeOfTheDay`, `SetDayDuration`, `SetIsDayAutoAdvanced`, their getters, and `GetEngineTime`. Signatures were checked through the read-only Enfusion API index and the installed vanilla time-and-weather handler. No original Escapists time implementation was reused.
The subsequent [041445 Core run](evidence/native-2026-09-19-041445/report.json) completes two escape/restart rounds with the archived 06:15 / 4x input and verifies native advancement in both rounds. The private profile's original primary, backup and temporary settings files were restored exactly afterward. This proves the tested nondefault round initialization, not long-running or network agreement.