]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make team queue compatible with g_balance_teams
authorz411 <z411@omaera.org>
Mon, 7 Nov 2022 16:22:42 +0000 (13:22 -0300)
committerz411 <z411@omaera.org>
Mon, 7 Nov 2022 16:22:42 +0000 (13:22 -0300)
qcsrc/server/client.qc
qcsrc/server/teamplay.qc

index 74e13d75346d19c4b2493e2333177e1ef0a2b991..fee973f18b78d0908c3143255f0cab1b80daa58e 100644 (file)
@@ -2070,6 +2070,11 @@ bool joinAllowed(entity this)
        if (MUTATOR_CALLHOOK(ForbidSpawn, this)) return false;
        if (ShowTeamSelection(this)) return false;
        if (CS(this).wants_join) return false;
+       if (IsQueueNeeded(this) && autocvar_g_balance_teams)
+       {
+               TeamBalance_JoinBestTeam(this);
+               return false;
+       }
        return true;
 }
 
index 46f9d5b1accbba49d99420a1f1b6a88f4f47311d..3f9e7951d292be82d7ba941b47303d5685b2630e 100644 (file)
@@ -256,7 +256,6 @@ entity SpectatorWantsJoin(entity this)
 
 bool SetPlayerTeam(entity player, int team_index, int type)
 {
-       LOG_INFO("SetPlayerTeam");
        int old_team_index = Entity_GetTeamIndex(player);
 
        if (!Player_SetTeamIndex(player, team_index))
@@ -274,13 +273,10 @@ bool SetPlayerTeam(entity player, int team_index, int type)
 
                if (team_index != -1)
                {
-                       LOG_INFOF("Is queue needed %d", IsQueueNeeded(player));
                        if (IsQueueNeeded(player) && !SpectatorWantsJoin(player))
                        {
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, INFO_JOIN_WANTS_TEAM), player.netname);
                                CS(player).wants_join = true; // TODO : Refactor
-                               bool res = TeamBalance_AreEqual(player);
-                               LOG_INFOF("result %d", res);
                        }
                        else
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, INFO_JOIN_PLAY_TEAM), player.netname);