X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qc;fp=qcsrc%2Fserver%2Fclient.qc;h=7bd24369e3154c200dc526599a091b1c227f1cbf;hp=cab642e67fd9b0f8e65a3eafedb54800e8cc3927;hb=12e3e2cb5f9d8cdd821a97894223fde2f5e2f816;hpb=9528dc8bdc7b4382c344598e88c49abeefa69b93 diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index cab642e67f..7bd24369e3 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -540,6 +540,14 @@ 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 (this.team < 0) TeamBalance_JoinBestTeam(this); @@ -810,9 +818,7 @@ void PutPlayerInServer(entity this) /** Called when a client spawns in the server */ void PutClientInServer(entity this) { - if (IS_BOT_CLIENT(this)) { - TRANSMUTE(Player, this); - } else if (IS_REAL_CLIENT(this)) { + if (IS_REAL_CLIENT(this)) { msg_entity = this; WriteByte(MSG_ONE, SVC_SETVIEW); WriteEntity(MSG_ONE, this); @@ -2269,6 +2275,14 @@ void ObserverOrSpectatorThink(entity this) } } + if (IS_BOT_CLIENT(this) && !CS(this).autojoin_checked) + { + CS(this).autojoin_checked = true; + TRANSMUTE(Player, this); + PutClientInServer(this); + return; + } + if (this.flags & FL_JUMPRELEASED) { if (PHYS_INPUT_BUTTON_JUMP(this) && (joinAllowed(this) || time < CS(this).jointime + MIN_SPEC_TIME)) { this.flags &= ~FL_JUMPRELEASED;