]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Lyberta/TeamplayOverhaul2
authorLyberta <lyberta@lyberta.net>
Sun, 29 Jul 2018 17:38:31 +0000 (20:38 +0300)
committerLyberta <lyberta@lyberta.net>
Sun, 29 Jul 2018 17:38:31 +0000 (20:38 +0300)
1  2 
qcsrc/server/client.qc
qcsrc/server/teamplay.qc

index 5251ee55f95c38b1327f88a926c78fa4f88e6876,909e89768b866bad6e8516c50ba7e66946301064..8075ff1e25cd66b7823888783da2276191cadc72
@@@ -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);
  
index f16846294ca48376de00d8172fbfc0874e7fc369,2c41ae18bdfc77b22113f5f36f40df8cb5d7ba23..1959fe369791811fd19385308acb52e3795df9be
@@@ -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)
        {
 -      if (this.team_forced > 0)
+               return;
+       }
+       int old_team_index = Team_TeamToIndex(this.team);
+       entity balance = TeamBalance_CheckAllowedTeams(this);
 -              int forced_team_index = Team_TeamToIndex(this.team_forced);
++      if (Player_HasRealForcedTeam(this))
+       {
++              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);