From a142ca90b33b6722b29e6084c808877d9a08cc4e Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Fri, 21 Oct 2022 01:30:25 +1000 Subject: [PATCH] Give bots genuine ready status, fixes not appearing ready until a human is ready --- qcsrc/server/bot/default/bot.qc | 7 +++++++ qcsrc/server/command/vote.qc | 6 +++--- qcsrc/server/command/vote.qh | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index d7cf429d7..5bfa79aa5 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -30,6 +30,7 @@ #include #include #include +#include STATIC_INIT(bot) { bot_calculate_stepheightvec(); } @@ -145,6 +146,12 @@ void bot_think(entity this) else if(this.aistatus & AI_STATUS_STUCK) navigation_unstuck(this); + if (warmup_stage && !this.ready) + { + this.ready = true; + ReadyCount(); // this must be delayed until the bot has spawned + } + // now call the current bot AI (havocbot for example) this.bot_ai(this); } diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 3db86c4c1..53f9a1715 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -86,7 +86,7 @@ bool Nagger_SendEntity(entity this, entity to, float sendflags) for (i = 1; i <= maxclients; i += 8) { for (f = 0, e = edict_num(i), b = BIT(0); b < BIT(8); b <<= 1, e = nextent(e)) - if (!IS_REAL_CLIENT(e) || e.ready) + if (e.ready) f |= b; WriteByte(MSG_ENTITY, f); } @@ -456,8 +456,8 @@ void ReadyRestart_force(bool is_fake_round_start) if(!is_fake_round_start && !warmup_stage) localcmd("\nsv_hook_warmupend\n"); - // reset the .ready status of all players (also spectators) - FOREACH_CLIENT(IS_REAL_CLIENT(it), { it.ready = false; }); + // reset the .ready status of all clients (including spectators and bots) + FOREACH_CLIENT(true, { it.ready = false; }); readycount = 0; Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client diff --git a/qcsrc/server/command/vote.qh b/qcsrc/server/command/vote.qh index 88e311beb..d92c6a065 100644 --- a/qcsrc/server/command/vote.qh +++ b/qcsrc/server/command/vote.qh @@ -63,7 +63,7 @@ void VoteCommand(int request, entity caller, int argc, string vote_command); const float RESTART_COUNTDOWN = 10; entity nagger; int readycount; // amount of players who are ready -.float ready; // flag for if a player is ready +.bool ready; // flag for if a player is ready .float last_ready; // last ready time for anti-spam .int team_saved; // team number to restore upon map reset .void(entity this) reset; // if set, an entity is reset using this -- 2.39.2