]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: fix bots using waypoints to reach a player when they could go straight to...
authorterencehill <piuntn@gmail.com>
Sun, 5 Nov 2017 10:39:06 +0000 (11:39 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 5 Nov 2017 10:39:06 +0000 (11:39 +0100)
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/navigation.qh

index 18c4383a0697a594ec47c48fc0ad76fdc2301940..3ac9661962fc8efbff43875da23252f54509b0b8 100644 (file)
@@ -1425,17 +1425,6 @@ int navigation_poptouchedgoals(entity this)
        if(vlen2(this.goalcurrent.origin - this.goalstack01.origin) > vlen2(this.goalstack01.origin - this.origin))
        if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
        {
-               // this can happen when a player stands still or is frozen
-               // NOTE: this is only needed because tracewalk always fail when destination
-               // point is on a player and bot_navigation_ignoreplayers is false
-               if (this.goalentity.navigation_dynamicgoal
-                       && boxesoverlap(this.absmin, this.absmax, this.goalentity.absmin, this.goalentity.absmax))
-               {
-                       navigation_poproute(this);
-                       ++removed_goals;
-                       return removed_goals;
-               }
-
                vector dest = '0 0 0';
                float dest_height = 0;
                SET_TRACEWALK_DESTCOORDS(this.goalstack01, this.origin, dest, dest_height);
index 35036798498178f4e813f1584a1746a8d1195856..63d066b51c12f047196507ba8f75c580fd627e0b 100644 (file)
@@ -65,10 +65,17 @@ entity navigation_bestgoal;
 
 // if ent is a box waypoint or an item v is set to coords of ent that are closer to org
 // (but v.z is set to the lowest coord of ent), v_height is set to ent's height
+// if destination ent is a player make so that destination point doesn't overlap with
+// player bbox, otherwise tracebox always fails (if bot_navigation_ignoreplayers is false)
 #define SET_TRACEWALK_DESTCOORDS(ent, org, v, v_height) MACRO_BEGIN { \
        if ((ent.classname != "waypoint") || ent.wpisbox) { \
                vector wm1 = ent.origin + ent.mins - eZ * (PL_MAX_CONST.z - 1); \
                vector wm2 = ent.origin + ent.maxs - eZ * (PL_MIN_CONST.z + 1); \
+               if (IS_PLAYER(ent) || IS_MONSTER(ent)) \
+               { \
+                       wm1 += vec2(PL_MIN_CONST) + '-1 -1 0'; \
+                       wm2 += vec2(PL_MAX_CONST) + '1 1 0'; \
+               } \
                v.x = bound(wm1.x, org.x, wm2.x); \
                v.y = bound(wm1.y, org.y, wm2.y); \
                v.z = wm1.z; \