]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'bones_was_here/q3compat' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index d2bb23cf68d96aff2d35064da123de450597405f..804025ace1e5efab8a88d140ff2db5808a72b2eb 100644 (file)
@@ -6,6 +6,7 @@
 #include <common/effects/qc/globalsound.qh>
 #include <common/ent_cs.qh>
 #include <common/gamemodes/_mod.qh>
+#include <common/gamemodes/gamemode/lms/sv_lms.qh>
 #include <common/gamemodes/gamemode/nexball/sv_nexball.qh>
 #include <common/items/_mod.qh>
 #include <common/items/inventory.qh>
@@ -617,8 +618,7 @@ void PutPlayerInServer(entity this)
        this.respawn_flags = 0;
        this.respawn_time = 0;
        STAT(RESPAWN_TIME, this) = 0;
-       bool q3dfcompat = autocvar_sv_q3defragcompat && autocvar_sv_q3defragcompat_changehitbox;
-       this.scale = ((q3dfcompat) ? 0.9 : autocvar_sv_player_scale);
+       this.scale = ((q3compat && autocvar_sv_q3compat_changehitbox) ? 0.9 : autocvar_sv_player_scale);
        this.fade_time = 0;
        this.pain_finished = 0;
        this.pushltime = 0;
@@ -1076,8 +1076,6 @@ string getwelcomemessage(entity this)
        return s;
 }
 
-bool autocvar_sv_qcphysics = true; // TODO this is for testing - remove when qcphysics work
-
 /**
 =============
 ClientConnect
@@ -2644,14 +2642,30 @@ 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;
+                               });
+                               if (maxclients - totalClients > autocvar_sv_maxidle_slots)
+                                       totalClients = 0;
+                       }
+               }
+               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 < autocvar_sv_maxidle_minplayers)
+               {
+                       // idle kick disabled
+                       CS(this).parm_idlesince = time;
+               }
                else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
                        if (CS(this).idlekick_lasttimeleft)
@@ -2680,6 +2694,7 @@ void PlayerPostThink (entity this)
                                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_MOVETOSPEC_IDLING, this.netname, maxidle_time);
                                        if (this.caplayer)
                                                this.caplayer = 0;
+                                       this.lms_spectate_warning = 2; // TODO: mutator hook for players forcibly moved to spectator?
                                        PutObserverInServer(this);
                                }
                                else