]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/navigation.qc
Part 2 of edc2958143 "Make sure bots don't move to removed goals such as a key when...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / navigation.qc
index 1d18a582ed3864c10d1d3f4063c30dfd91e0f040..19c0ed8e600337c22590dfda6342fb7fd91e226f 100644 (file)
@@ -7,9 +7,10 @@
 
 #include <common/t_items.qh>
 
-#include <common/items/all.qh>
+#include <common/items/_mod.qh>
 
 #include <common/constants.qh>
+#include <common/net_linked.qh>
 #include <common/triggers/trigger/jumppads.qh>
 
 .float speed;
@@ -892,7 +893,7 @@ void navigation_poptouchedgoals(entity this)
        }
 
        // If for some reason the bot is closer to the next goal, pop the current one
-       if(this.goalstack01)
+       if(this.goalstack01 && !wasfreed(this.goalstack01))
        if(vlen2(this.goalcurrent.origin - this.origin) > vlen2(this.goalstack01.origin - this.origin))
        if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
        if(tracewalk(this, this.origin, this.mins, this.maxs, (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5, bot_navigation_movemode))
@@ -908,7 +909,7 @@ void navigation_poptouchedgoals(entity this)
        }
 
        // HACK: remove players/bots as goals, they can lead a bot to unexpected places (cliffs, lava, etc)
-       // TODO: rate waypoints near the targetted player at that moment, instead of the player itthis
+       // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
        if(IS_PLAYER(this.goalcurrent))
                navigation_poproute(this);
 
@@ -1000,7 +1001,7 @@ void botframe_updatedangerousobjects(float maxupdate)
                danger = 0;
                m1 = it.mins;
                m2 = it.maxs;
-               FOREACH_ENTITY_FLOAT(bot_dodge, true,
+               IL_EACH(g_bot_dodge, it.bot_dodge,
                {
                        v = it.origin;
                        v.x = bound(m1_x, v.x, m2_x);
@@ -1031,7 +1032,7 @@ void navigation_unstuck(entity this)
 
        if (!bot_waypoint_queue_owner)
        {
-               LOG_DEBUG(this.netname, " sutck, taking over the waypoints queue");
+               LOG_DEBUG(this.netname, " stuck, taking over the waypoints queue");
                bot_waypoint_queue_owner = this;
                bot_waypoint_queue_bestgoal = NULL;
                bot_waypoint_queue_bestgoalrating = 0;
@@ -1043,7 +1044,7 @@ void navigation_unstuck(entity this)
        if (bot_waypoint_queue_goal)
        {
                // evaluate the next goal on the queue
-               float d = vlen(this.origin - bot_waypoint_queue_goal.origin);
+               float d = vlen2(this.origin - bot_waypoint_queue_goal.origin);
                LOG_DEBUG(this.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d));
                if(tracewalk(bot_waypoint_queue_goal, this.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), bot_waypoint_queue_goal.origin, bot_navigation_movemode))
                {