From: bones_was_here Date: Thu, 5 Oct 2023 15:16:46 +0000 (+1000) Subject: sv_autopause: don't pause during intermission, unpause on endmatch command X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=bafbbff8ced1375471dea1d645785b07108339d9;p=xonotic%2Fxonotic-data.pk3dir.git sv_autopause: don't pause during intermission, unpause on endmatch command --- diff --git a/qcsrc/server/main.qc b/qcsrc/server/main.qc index 0d36ea47e..d03edc9cb 100644 --- a/qcsrc/server/main.qc +++ b/qcsrc/server/main.qc @@ -187,12 +187,14 @@ void CreatureFrame_All() }); } +// 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; @@ -207,9 +209,12 @@ void Pause_TryPause() 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(); @@ -293,7 +298,6 @@ void StartFrame() 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; @@ -346,6 +350,10 @@ void StartFrame() 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; diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 311800dcd..6e79c73ef 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -1063,7 +1063,7 @@ spawnfunc(worldspawn) 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;