]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Disable sv_maxidle when playing alone, disable both sv_maxidle and sv_maxidle_playert...
authorterencehill <piuntn@gmail.com>
Sun, 15 Aug 2021 16:23:19 +0000 (18:23 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 15 Aug 2021 16:23:19 +0000 (18:23 +0200)
qcsrc/server/client.qc

index a9758146f5dddfaca618b7ddc6b6a624fa7da1ef..8156bce181691f6e7490363fb0cbdb2e864716a0 100644 (file)
@@ -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)