From: terencehill Date: Thu, 12 May 2022 00:53:59 +0000 (+0200) Subject: Check .bot_forced_team validity immediately X-Git-Tag: xonotic-v0.8.5~39 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=95b1790ffe7f82d110942035e9cfbbfc0acc92ba;p=xonotic%2Fxonotic-data.pk3dir.git Check .bot_forced_team validity immediately --- diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 792bde7cd..890cb6e42 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -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; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 7bd24369e..2e6e9e6b8 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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);