From: z411 Date: Mon, 7 Nov 2022 16:22:42 +0000 (-0300) Subject: Make team queue compatible with g_balance_teams X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f1619c44256d0317b6968098860afe107b52fe92;p=xonotic%2Fxonotic-data.pk3dir.git Make team queue compatible with g_balance_teams --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 74e13d753..fee973f18 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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; } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 46f9d5b1a..3f9e7951d 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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);