]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement 866ee9e66 "If for some reason a bot selects teleport/jumppad/warpzone origi...
authorterencehill <piuntn@gmail.com>
Sun, 13 Aug 2017 15:49:09 +0000 (17:49 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 13 Aug 2017 15:49:09 +0000 (17:49 +0200)
qcsrc/server/bot/default/navigation.qc

index 1fdee2e10a554446939da53437603e5150d5f230..dac5e2c3bf9f2d37328663b6eea2eea1da2d3e15 100644 (file)
@@ -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...