]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: fix tracewalk failing to reach a player when it starts from above them
authorterencehill <piuntn@gmail.com>
Sat, 23 Jun 2018 20:25:48 +0000 (22:25 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 23 Jun 2018 20:25:48 +0000 (22:25 +0200)
qcsrc/server/bot/default/navigation.qc

index d69da71a521ae04832f8780ba6ff9f9905994fd4..6ae5feba09eb0486f52300aa5b134f5cba96796d 100644 (file)
@@ -126,8 +126,18 @@ void set_tracewalk_dest(entity ent, vector org, bool fix_player_dest)
                // z coord is set to ent's min height
                tracewalk_dest.x = bound(wm1.x, org.x, wm2.x);
                tracewalk_dest.y = bound(wm1.y, org.y, wm2.y);
-               tracewalk_dest.z = wm1.z;
-               tracewalk_dest_height = wm2.z - wm1.z; // destination height
+               if ((IS_PLAYER(ent) || IS_MONSTER(ent))
+                       && org.x == tracewalk_dest.x && org.y == tracewalk_dest.y && org.z > tracewalk_dest.z)
+               {
+                       tracewalk_dest.z = wm2.z - PL_MIN_CONST.z;
+                       tracewalk_dest_height = 0;
+                       fix_player_dest = false;
+               }
+               else
+               {
+                       tracewalk_dest.z = wm1.z;
+                       tracewalk_dest_height = wm2.z - wm1.z;
+               }
        }
        else
        {