]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Check .bot_forced_team validity immediately
authorterencehill <piuntn@gmail.com>
Thu, 12 May 2022 00:53:59 +0000 (02:53 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 12 May 2022 01:22:48 +0000 (03:22 +0200)
qcsrc/server/bot/default/bot.qc
qcsrc/server/client.qc

index 792bde7cd969c395c6b835f5733fa512f3862d1a..890cb6e42ec8969355b5041f4810377a39d6dc2c 100644 (file)
@@ -243,7 +243,11 @@ void bot_setnameandstuff(entity this)
        else bot_pants = ftos(floor(random() * 15));
 
        if (teamplay && !(autocvar_bot_vs_human && AvailableTeams() == 2))
+       {
                this.bot_forced_team = stof(argv(5));
+               if (!Team_IsValidIndex(this.bot_forced_team))
+                       this.bot_forced_team = 0;
+       }
        else
                this.bot_forced_team = 0;
 
index 7bd24369e3154c200dc526599a091b1c227f1cbf..2e6e9e6b852c84a6b6ffe5bec87524fb59e6a260 100644 (file)
@@ -540,13 +540,8 @@ void PutPlayerInServer(entity this)
        PlayerState_attach(this);
        accuracy_resend(this);
 
-       if (IS_BOT_CLIENT(this))
-       {
-               if (teamplay && Team_IsValidIndex(this.bot_forced_team))
-                       SetPlayerTeam(this, this.bot_forced_team, TEAM_CHANGE_MANUAL);
-               else
-                       this.bot_forced_team = 0;
-       }
+       if (teamplay && this.bot_forced_team)
+               SetPlayerTeam(this, this.bot_forced_team, TEAM_CHANGE_MANUAL);
 
        if (this.team < 0)
                TeamBalance_JoinBestTeam(this);