]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/navigation.qc
Bot AI: fix bots getting stuck in oblique warpzones (in the map hyperspace there...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / navigation.qc
index cb003dbd3c630af77c2e19feee66f84509852fa7..8fe72ff6377d6690480eb61c7f6121e44a5cd32d 100644 (file)
@@ -916,7 +916,7 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom
        vector pm2 = ent.origin + ent.maxs;
 
        // do two scans, because box test is cheaper
-       IL_EACH(g_waypoints, it != ent && it != except,
+       IL_EACH(g_waypoints, it != ent && it != except && !(it.wpflags & WAYPOINTFLAG_TELEPORT),
        {
                if(boxesoverlap(pm1, pm2, it.absmin, it.absmax))
                {
@@ -1608,6 +1608,16 @@ int navigation_poptouchedgoals(entity this)
 
        if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
        {
+               if (!this.goalcurrent.wpisbox // warpzone
+                       && vlen2(this.origin - this.goalstack01.origin) < vlen2(this.origin - this.goalcurrent.origin))
+               {
+                       navigation_poproute(this);
+                       ++removed_goals;
+                       navigation_poproute(this);
+                       ++removed_goals;
+                       return removed_goals;
+               }
+
                // make sure jumppad is really hit, don't rely on distance based checks
                // as they may report a touch even if it didn't really happen
                if(this.lastteleporttime > 0 && TELEPORT_USED(this, this.goalcurrent))