]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: fix bots sometimes getting stuck on a ledge above a jumppad (e.g. Mentalspace)
authorterencehill <piuntn@gmail.com>
Wed, 11 Jul 2018 15:34:52 +0000 (17:34 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 11 Jul 2018 15:34:52 +0000 (17:34 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc

index a2c6e2686311b7ab830853e932aae3425f9c5ab5..580d5ad7acf03dc6106dc76eac32452dbbfa7d00 100644 (file)
@@ -861,13 +861,18 @@ void havocbot_movetogoal(entity this)
                // if bot used the jumppad, push towards jumppad origin until jumppad waypoint gets removed
                destorg = this.goalcurrent.origin;
        }
-       else if (this.goalcurrent.wpisbox && boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z))
+       else if (this.goalcurrent.wpisbox)
        {
                // if bot is inside the teleport waypoint, head to teleport origin until teleport gets used
-               bunnyhop_forbidden = true;
-               destorg = this.goalcurrent.origin;
-               if(destorg.z > this.origin.z)
-                       PHYS_INPUT_BUTTON_JUMP(this) = true;
+               // do it even if bot is on a ledge above a teleport/jumppad so it doesn't get stuck
+               if (boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z)
+                       || (this.absmin.z > destorg.z && destorg.x == this.origin.x && destorg.y == this.origin.y))
+               {
+                       bunnyhop_forbidden = true;
+                       destorg = this.goalcurrent.origin;
+                       if(destorg.z > this.origin.z)
+                               PHYS_INPUT_BUTTON_JUMP(this) = true;
+               }
        }
 
        diff = destorg - this.origin;