]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot aim: avoid a glitch at the moment bot is teleported but teleport waypoint isn...
authorterencehill <piuntn@gmail.com>
Tue, 1 Aug 2017 15:04:45 +0000 (17:04 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 3 Aug 2017 08:51:04 +0000 (10:51 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc

index f5b126ff15adeddf3c9b88117eb138572dfd18f2..dde996d19c5b9f0f36c98a7402da010bb1b0515a 100644 (file)
@@ -139,10 +139,17 @@ void havocbot_ai(entity this)
                vector v, now, next;
                float aimdistance,skillblend,distanceblend,blend;
 
-               if(this.goalcurrent.wpisbox && boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin, this.origin))
-                       v = this.goalcurrent.origin;
-               else
-                       SET_DESTCOORDS(this.goalcurrent, this.origin, v);
+               SET_DESTCOORDS(this.goalcurrent, this.origin, v);
+               if(this.goalcurrent.wpisbox)
+               {
+                       // avoid a glitch when bot is teleported but teleport waypoint isn't removed yet
+                       if(this.goalstack02 && this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT
+                       && this.lastteleporttime > 0 && time - this.lastteleporttime < 0.15)
+                               v = (this.goalstack02.absmin + this.goalstack02.absmax) * 0.5;
+                       // aim to teleport origin if bot is inside teleport waypoint but hasn't touched the real teleport yet
+                       else if(boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin, this.origin))
+                               v = this.goalcurrent.origin;
+               }
                next = now = v - (this.origin + this.view_ofs);
                aimdistance = vlen(now);