From: terencehill Date: Sun, 13 Aug 2017 15:49:09 +0000 (+0200) Subject: Implement 866ee9e66 "If for some reason a bot selects teleport/jumppad/warpzone origi... X-Git-Tag: xonotic-v0.8.5~2378^2~86 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cb01fb0977a3dd3fa4bc37e33ea63ddf73f2105e;p=xonotic%2Fxonotic-data.pk3dir.git Implement 866ee9e66 "If for some reason a bot selects teleport/jumppad/warpzone origin as route destination automatically add teleport/jumppad/warpzone destination to the route" in another way to prevent an infinite loop --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 1fdee2e10..dac5e2c3b 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1240,19 +1240,25 @@ bool navigation_routetogoal(entity this, entity e, vector startposition) if (!e) return false; + entity teleport_goal = NULL; + + this.goalentity = e; + if(e.wpflags & WAYPOINTFLAG_TELEPORT) { // force teleport destination as route destination - e.wp00.enemy = e; - e = e.wp00; + teleport_goal = e; + navigation_pushroute(this, e.wp00); + this.goalentity = e.wp00; } - this.goalentity = e; - // put the entity on the goal stack //print("routetogoal ", etos(e), "\n"); navigation_pushroute(this, e); + if(teleport_goal) + e = this.goalentity; + if(e.classname == "waypoint" && !(e.wpflags & WAYPOINTFLAG_PERSONAL)) { this.wp_goal_prev1 = this.wp_goal_prev0; @@ -1277,6 +1283,8 @@ bool navigation_routetogoal(entity this, entity e, vector startposition) e = e.nearestwaypoint; nearest_wp = e; } + else if(teleport_goal) + e = teleport_goal; else e = e.enemy; // we already have added it, so...