]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Give bots genuine ready status, fixes not appearing ready until a human is ready
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 20 Oct 2022 15:30:25 +0000 (01:30 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 6 Jan 2023 07:16:11 +0000 (17:16 +1000)
qcsrc/server/bot/default/bot.qc
qcsrc/server/command/vote.qc
qcsrc/server/command/vote.qh

index d7cf429d74e150a8324c0c30bfe0245d683658f1..5bfa79aa55edbb3ace3986e6fe60c8721d259329 100644 (file)
@@ -30,6 +30,7 @@
 #include <server/weapons/accuracy.qh>
 #include <server/weapons/selection.qh>
 #include <server/world.qh>
+#include <server/command/vote.qh>
 
 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);
 }
index 3db86c4c1803383a1060b7357a9216ca0393335b..53f9a1715604065e8f7d500125df0681e4b1c8f2 100644 (file)
@@ -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
 
index 88e311beb670eb4581deec4f2ff2b12a72656af5..d92c6a0656d05066dd0c7a182681c7ad8847b0db 100644 (file)
@@ -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