From: terencehill Date: Sun, 15 Aug 2021 16:23:19 +0000 (+0200) Subject: Disable sv_maxidle when playing alone, disable both sv_maxidle and sv_maxidle_playert... X-Git-Tag: xonotic-v0.8.5~353^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=44bbc022f311980364935ee6ea5236bf7858ac7b;p=xonotic%2Fxonotic-data.pk3dir.git Disable sv_maxidle when playing alone, disable both sv_maxidle and sv_maxidle_playertospectator in singleplayer / campaign --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index a9758146f..8156bce18 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2643,14 +2643,29 @@ void PlayerPostThink (entity this) int totalClients = 0; if(autocvar_sv_maxidle > 0 && autocvar_sv_maxidle_slots > 0) { - FOREACH_CLIENT(IS_REAL_CLIENT(it) || autocvar_sv_maxidle_slots_countbots, + // maxidle disabled in local matches by not counting clients (totalClients 0) + if (server_is_dedicated) + { + FOREACH_CLIENT(IS_REAL_CLIENT(it) || autocvar_sv_maxidle_slots_countbots, + { + ++totalClients; + }); + } + } + else if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0) + { + FOREACH_CLIENT(IS_REAL_CLIENT(it), { ++totalClients; }); } - if (autocvar_sv_maxidle > 0 && autocvar_sv_maxidle_slots > 0 && (maxclients - totalClients) > autocvar_sv_maxidle_slots) - { /* do nothing */ } + if (totalClients <= 1 + || (autocvar_sv_maxidle > 0 && autocvar_sv_maxidle_slots > 0 && (maxclients - totalClients) > autocvar_sv_maxidle_slots)) + { + CS(this).parm_idlesince = time; + /* do nothing */ + } else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10 { if (CS(this).idlekick_lasttimeleft)