]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: add ability to slow down if bot is in the air and goal is under it; it gives...
authorterencehill <piuntn@gmail.com>
Mon, 21 May 2018 22:40:50 +0000 (00:40 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 21 May 2018 22:40:50 +0000 (00:40 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc

index 5fb9e728adb5b585743b8a3a22b85325f11e0e96..b5888c0b9f770579b287a1e2b47b05a10277a141 100644 (file)
@@ -1069,6 +1069,18 @@ void havocbot_movetogoal(entity this)
                                if(IS_PLAYER(this.goalcurrent))
                                        unreachable = true;
                        }
+
+                       // slow down if bot is in the air and goal is under it
+                       if (!this.goalcurrent.wphardwired
+                               && vdist(flat_diff, <, 250) && this.origin.z - destorg.z > 120
+                               && (!IS_ONGROUND(this) || vdist(vec2(this.velocity), >, maxspeed * 0.3)))
+                       {
+                               // tracebox wouldn't work when bot is still on the ledge
+                               traceline(this.origin, this.origin - '0 0 200', true, this);
+                               if (this.origin.z - trace_endpos.z > 120)
+                                       evadeobstacle = normalize(this.velocity) * -1;
+                       }
+
                        if(unreachable)
                        {
                                navigation_clearroute(this);