From 34bc92b1c4ed5cacbc44ad23b502c221e2959d8e Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 23 Jan 2018 16:21:21 +0100 Subject: [PATCH] Slightly better workaround for the permanent bot spectator issue --- qcsrc/server/bot/default/bot.qc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) 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; -- 2.39.2