X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmain.qc;h=8a2da54aa4a721c2312017b0bd30ae52bd72e561;hb=593102f121eb7ce5139e8c186cc64ba870a5b446;hp=cf91b9de4bafd7d6b250a860732702a82222f409;hpb=219f56360ab1d5207d3275deaf110c10e61e9436;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/main.qc b/qcsrc/server/main.qc index cf91b9de4..8a2da54aa 100644 --- a/qcsrc/server/main.qc +++ b/qcsrc/server/main.qc @@ -186,20 +186,35 @@ void CreatureFrame_All() }); } -void Pause_TryPause(bool ispaused) +void Pause_TryPause_Dedicated(entity this) { - int n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { - if (PHYS_INPUT_BUTTON_CHAT(it) != ispaused) return; + if (player_count == 0) + setpause(1); +} + +void Pause_TryPause() +{ + int n = 0, p = 0; + FOREACH_CLIENT(IS_REAL_CLIENT(it), { + if (PHYS_INPUT_BUTTON_CHAT(it)) ++p; ++n; }); if (!n) return; - setpause(ispaused); + if (n == p) + setpause(1); + else + setpause(0); } void SV_PausedTic(float elapsedtime) { - if (!server_is_dedicated) Pause_TryPause(false); + if (!server_is_dedicated) + { + if (autocvar_sv_autopause) + Pause_TryPause(); + else + setpause(0); + } } void dedicated_print(string input) @@ -268,7 +283,6 @@ Called before each frame by the server bool game_delay_last; -bool autocvar_sv_autopause = false; void systems_update(); void sys_phys_update(entity this, float dt); void StartFrame() @@ -278,7 +292,7 @@ void StartFrame() IL_EACH(g_players, IS_FAKE_CLIENT(it), PlayerPreThink(it)); execute_next_frame(); - if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true); + if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(); delete_fn = remove_unsafely; // not during spawning! serverprevtime = servertime; @@ -331,8 +345,8 @@ void StartFrame() CreatureFrame_All(); CheckRules_World(); - if (warmup_stage && !game_stopped && warmup_limit > 0 && time >= warmup_limit) { - ReadyRestart(); + if (warmup_stage && !game_stopped && warmup_limit > 0 && time - game_starttime >= warmup_limit) { + ReadyRestart(true); return; }