]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix join bug when g_balance_teams is 1
authorz411 <z411@omaera.org>
Mon, 5 Jun 2023 20:33:23 +0000 (16:33 -0400)
committerz411 <z411@omaera.org>
Mon, 5 Jun 2023 20:33:23 +0000 (16:33 -0400)
qcsrc/server/client.qc
qcsrc/server/teamplay.qc

index fd1ac7f3ef370a91a91ab63ee3939862459fe00d..2cb7e5cc04ab37517265c4e1861c62bb0c2fc507 100644 (file)
@@ -2104,6 +2104,17 @@ int nJoinAllowed(entity this, entity ignore)
        return free_slots;
 }
 
+bool queuePlayer(entity this)
+{
+       if(IsQueueNeeded(this) && !SpectatorWantsJoin(this))
+       {
+               if(autocvar_g_balance_teams)
+                       TeamBalance_JoinBestTeam(this);
+               return true;
+       }
+       return false;
+}
+
 bool joinAllowed(entity this)
 {
        if (CS(this).version_mismatch) return false;
@@ -2113,11 +2124,7 @@ bool joinAllowed(entity this)
        if (MUTATOR_CALLHOOK(ForbidSpawn, this)) return false;
        if (ShowTeamSelection(this)) return false;
        if (this.wants_join) return false;
-       if (IsQueueNeeded(this) && autocvar_g_balance_teams)
-       {
-               TeamBalance_JoinBestTeam(this);
-               return false;
-       }
+       if (queuePlayer(this)) return false;
        return true;
 }
 
index 140d52624855b452e81b572fce9b6947d2edb73e..f0e68ce263bc966f8b866c2b8183091e524ec1d9 100644 (file)
@@ -280,7 +280,9 @@ bool SetPlayerTeam(entity player, int team_index, int type)
                                player.wants_join = team_index; // Player queued to join
                        }
                        else
+                       {
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, INFO_JOIN_PLAY_TEAM), player.netname);
+                       }
                }
        }