From: terencehill Date: Tue, 23 Jan 2018 15:21:21 +0000 (+0100) Subject: Slightly better workaround for the permanent bot spectator issue X-Git-Tag: xonotic-v0.8.5~2372 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=34bc92b1c4ed5cacbc44ad23b502c221e2959d8e;p=xonotic%2Fxonotic-data.pk3dir.git Slightly better workaround for the permanent bot spectator issue --- diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 98a521761..9eae91d85 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -597,16 +597,6 @@ float bot_fixcount() ++realplayers; }); } - if(currentbots == -1) - { - currentbots = 0; - // human players joining early may cause weird issues (bots appearing on - // the scoreboard as spectators) when switching map with the gotomap - // command, as it doesn't remove bots of the previous match, and with - // minplayers > 1, so ignore human players in the first bot frame - // TODO maybe find a cleaner solution - activerealplayers = 0; - } int bots; // add/remove bots if needed to make sure there are at least @@ -692,12 +682,23 @@ void bot_serverframe() if (game_stopped) return; - if (time < 2) + // Added 0.5 to avoid possible addition + immediate removal of bots that would make them appear as + // spectators in the scoreboard and never go away. This issue happens at time 2 if map is changed + // with the gotomap command, minplayers is > 1 and human clients join as players very soon + // either intentionally or automatically (sv_spectate 0) + if (time < 2.5) { currentbots = -1; return; } + if (currentbots == -1) + { + // count bots already in the server from the previous match + currentbots = 0; + FOREACH_CLIENT(IS_BOT_CLIENT(it), { ++currentbots; }); + } + if(autocvar_skill != skill) { float wpcost_update = false;