Make empty-server restarts configurable in the mission menu

Add persistent last-disconnect and idle-interval controls with enabled/five-hour defaults. Apply saved settings immediately, reset idle time while occupied, and cover migration, routing, layout and restart behavior.
This commit is contained in:
2026-10-14 14:05:46 +02:00
parent 0048527fe2
commit e4ca37dfc1
13 changed files with 242 additions and 61 deletions
+19
View File
@@ -60,6 +60,25 @@ requested totals instead of preventing mission startup. The admin Status page
also shows these totals. This is an interim checkpoint system, independent of the
existing HQ-directed road interceptions.
## Mission restarts
The admin menu **Mission** page includes two independent settings:
- **Restart after last disconnect**: Enabled or Disabled, default Enabled.
- **Restart while empty (hours)**: 0 disables the idle timer; 1–168 sets the
number of real hours continuously empty. Default 5. Press **Apply** to save.
Both apply immediately and persist in `$profile:Escapists.json` as
`mission.restartOnEmpty` and `mission.emptyRestartHours`. Older configurations
receive the enabled/five-hour defaults. The idle interval starts with a new
mission or the last disconnect and resets whenever players connect. Connected
spectators and players loading in also prevent an empty-server restart.
Changing the interval uses the time already spent empty. Normal victory/defeat
and no-survivor endings still apply when these options are disabled.
Chat equivalents are `/esc mission restartempty set on|off` and
`/esc mission emptyhours set N`; both also support `show` and `help`.
## One server configuration
All mission preferences now live in **`$profile:Escapists.json`** on the server.
+13 -5
View File
@@ -70,21 +70,29 @@ The server's scene deadline now reaches the existing owned-ticket rejection even
## Empty-server restarts (14 October 2026)
When the last player disconnects, the next server tick ends the mission through
By default, when the last player disconnects, the next server tick ends the mission through
the normal native end/reload sequence. This includes players who leave before
admission finishes. Living reconnect reservations do not keep a completely empty
mission running. While another player remains connected, the existing reserved
body and reconnect behavior still applies.
body and reconnect behavior still applies. Administrators can disable this
behavior using **Mission → Restart after last disconnect** to preserve the
round for reconnects, subject to the idle timer and normal round endings.
A fresh mission with no connections restarts after five hours of real elapsed
time. Each newly loaded mission starts a new five-hour window. Mission time and
time by default. **Mission → Restart while empty (hours)** accepts 0 to disable
the timer or 1–168 hours. The interval starts at mission initialization or the
last disconnect, and is reset while players are connected. Both controls save
immediately for this and future missions; interval changes use the elapsed empty
time rather than restarting the timer. Mission time and
time-multiplier settings do not change this interval. Connected players, including
spectators and players loading in, prevent the empty-server restart. The check
also runs during preparation; it stops with the mission's services. Both restart
reasons are written to the server log.
`test_empty_server_restart.py` executes the production restart check and tick
wrapper, covering the five-hour boundary, repeated empty rounds, last disconnect,
connections between ticks, preparation, authority and duplicate-end prevention.
wrapper, covering independent disabled/enabled settings, interval boundaries,
live changes, repeated empty rounds, last disconnect, connections between ticks,
preparation, authority and duplicate-end prevention. Settings and menu tests
cover migration defaults, persistence, invalid values, failed saves and routing.
The restart uses the existing native end/reload path. These offline checks do
not establish live dedicated-server disconnect/reload timing.