From: Lyberta Date: Sun, 29 Jul 2018 17:38:31 +0000 (+0300) Subject: Merge branch 'master' into Lyberta/TeamplayOverhaul2 X-Git-Tag: xonotic-v0.8.5~1899^2~14 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8f4e38f34794f44d2ea707ca4b836d88b0a39c3d;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Lyberta/TeamplayOverhaul2 --- 8f4e38f34794f44d2ea707ca4b836d88b0a39c3d diff --cc qcsrc/server/client.qc index 5251ee55f,909e89768..8075ff1e2 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@@ -1263,11 -1263,42 +1263,11 @@@ void ClientConnect(entity this TRANSMUTE(Client, this); CS(this).version_nagtime = time + 10 + random() * 10; - Player_DetermineForcedTeam(this); + Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_CONNECT, this.netname); + + bot_clientconnect(this); - int playerid_save = this.playerid; - this.playerid = 0; // silent - this.playerid = playerid_save; - // identify the right forced team - if (autocvar_g_campaign) - { - if (IS_REAL_CLIENT(this)) // only players, not bots - { - switch (autocvar_g_campaign_forceteam) - { - case 1: this.team_forced = NUM_TEAM_1; break; - case 2: this.team_forced = NUM_TEAM_2; break; - case 3: this.team_forced = NUM_TEAM_3; break; - case 4: this.team_forced = NUM_TEAM_4; break; - default: this.team_forced = 0; - } - } - } - else if (PlayerInList(this, autocvar_g_forced_team_red)) this.team_forced = NUM_TEAM_1; - else if (PlayerInList(this, autocvar_g_forced_team_blue)) this.team_forced = NUM_TEAM_2; - else if (PlayerInList(this, autocvar_g_forced_team_yellow)) this.team_forced = NUM_TEAM_3; - else if (PlayerInList(this, autocvar_g_forced_team_pink)) this.team_forced = NUM_TEAM_4; - else switch (autocvar_g_forced_team_otherwise) - { - default: this.team_forced = 0; break; - case "red": this.team_forced = NUM_TEAM_1; break; - case "blue": this.team_forced = NUM_TEAM_2; break; - case "yellow": this.team_forced = NUM_TEAM_3; break; - case "pink": this.team_forced = NUM_TEAM_4; break; - case "spectate": - case "spectator": - this.team_forced = -1; - break; - } - if (!teamplay && this.team_forced > 0) this.team_forced = 0; ++ Player_DetermineForcedTeam(this); TRANSMUTE(Observer, this); diff --cc qcsrc/server/teamplay.qc index f16846294,2c41ae18b..1959fe369 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@@ -756,13 -638,30 +755,30 @@@ void TeamBalance_JoinBestTeam(entity th { return; } - - // find out what teams are available - entity balance = TeamBalance_CheckAllowedTeams(this); - if (this.bot_forced_team) { + return; + } + int old_team_index = Team_TeamToIndex(this.team); + entity balance = TeamBalance_CheckAllowedTeams(this); - if (this.team_forced > 0) ++ if (Player_HasRealForcedTeam(this)) + { - int forced_team_index = Team_TeamToIndex(this.team_forced); ++ int forced_team_index = this.team_forced; + bool is_team_allowed = TeamBalance_IsTeamAllowedInternal(balance, + forced_team_index); TeamBalance_Destroy(balance); + if (!is_team_allowed) + { + return; + } + if (!SetPlayerTeam(this, forced_team_index, TEAM_CHANGE_AUTO)) + { + return; + } + if ((old_team_index != -1) && !IS_BOT_CLIENT(this)) + { + TeamBalance_AutoBalanceBots(forced_team_index, old_team_index); + } return; } int best_team_index = TeamBalance_FindBestTeam(balance, this, true);