From: z411 Date: Mon, 5 Jun 2023 20:33:23 +0000 (-0400) Subject: Fix join bug when g_balance_teams is 1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6f3c23e2121bd94f8c6c6f470176d8b376ab9260;p=xonotic%2Fxonotic-data.pk3dir.git Fix join bug when g_balance_teams is 1 --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index fd1ac7f3e..2cb7e5cc0 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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; } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 140d52624..f0e68ce26 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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); + } } }