From: terencehill Date: Fri, 10 Nov 2017 09:51:51 +0000 (+0100) Subject: Bot AI: allow to find nearest waypoint of players in the air so that they can be... X-Git-Tag: xonotic-v0.8.5~2378^2~23 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=01376c61cd;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: allow to find nearest waypoint of players in the air so that they can be found when bot starts a goal search --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index b61939499..98403bc4d 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -948,15 +948,28 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom if(walkfromwp && (it.wpflags & WAYPOINTFLAG_NORELINK)) continue; v = it.origin; - if(walkfromwp) - set_tracewalk_dest(ent, v, false); + + if (walkfromwp) + { + set_tracewalk_dest(ent, v, true); + if (trace_ent == ent) + { + bestdist = 0; + best = it; + break; + } + } else set_tracewalk_dest(it, org, false); + if (navigation_waypoint_will_link(v, org, ent, tracewalk_dest, tracewalk_dest_height, tracewalk_dest, tracewalk_dest_height, walkfromwp, bestdist)) { - bestdist = vlen(v - org); + if (walkfromwp) + bestdist = vlen(tracewalk_dest - org); + else + bestdist = vlen(v - org); best = it; } });