});
}
+// called shortly after map change in dedicated
void Pause_TryPause_Dedicated(entity this)
{
- if (player_count == 0)
+ if (player_count == 0 && !intermission_running && !autocvar__endmatch)
setpause(1);
}
+// called every normal frame in singleplayer/listen
void Pause_TryPause()
{
int n = 0, p = 0;
setpause(0);
}
+// called every paused frame by DP
void SV_PausedTic(float elapsedtime)
{
- if (!server_is_dedicated)
+ if (autocvar__endmatch) // `endmatch` while paused
+ setpause(0); // proceed to intermission
+ else if (!server_is_dedicated)
{
if (autocvar_sv_autopause)
Pause_TryPause();
IL_EACH(g_players, IS_FAKE_CLIENT(it), PlayerPreThink(it));
execute_next_frame();
- if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause();
delete_fn = remove_unsafely; // not during spawning!
serverprevtime = servertime;
CreatureFrame_All();
CheckRules_World();
+ // after CheckRules_World() as it may set intermission_running, and after RedirectionThink() in case listen server is closing
+ if (autocvar_sv_autopause && !server_is_dedicated && !intermission_running)
+ Pause_TryPause();
+
if (warmup_stage && !game_stopped && warmup_limit > 0 && time - game_starttime >= warmup_limit) {
ReadyRestart(true);
return;
WinningConditionHelper(this); // set worldstatus
if (autocvar_sv_autopause && server_is_dedicated && !wantrestart)
- // INITPRIO_LAST is to soon: bots either didn't join yet or didn't leave yet, see: bot_fixcount()
+ // INITPRIO_LAST is too soon: bots either didn't join yet or didn't leave yet, see: bot_fixcount()
defer(this, 5, Pause_TryPause_Dedicated);
world_initialized = 1;