]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/havocbot/havocbot.qc
If for some reason final goal was removed clear route instead of simply removing it
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / havocbot / havocbot.qc
index 606857611490466116175de4c81f3bb210637438..3d4e298d13fe6196ab4784a297f677a62795faf3 100644 (file)
@@ -674,7 +674,39 @@ void havocbot_movetogoal(entity this)
        if (this.goalcurrent == NULL)
                return;
 
-       navigation_poptouchedgoals(this);
+
+       bool locked_goal = false;
+       if(this.goalentity && wasfreed(this.goalentity))
+       {
+               navigation_clearroute(this);
+               this.bot_strategytime = 0;
+               return;
+       }
+       else if(this.goalentity.bot_pickup)
+       {
+               if(this.goalentity.bot_pickup_respawning)
+               {
+                       if(this.goalentity.solid) // item respawned
+                               this.goalentity.bot_pickup_respawning = false;
+                       else if(time < this.goalentity.scheduledrespawntime - 10) // item already taken (by someone else)
+                       {
+                               this.goalentity.bot_pickup_respawning = false;
+                               navigation_clearroute(this);
+                               this.bot_strategytime = 0;
+                               return;
+                       }
+                       else if(this.goalentity == this.goalcurrent)
+                               locked_goal = true; // wait for item to respawn
+               }
+               else if(!this.goalentity.solid)
+               {
+                       navigation_clearroute(this);
+                       this.bot_strategytime = 0;
+                       return;
+               }
+       }
+       if(!locked_goal)
+               navigation_poptouchedgoals(this);
 
        // if ran out of goals try to use an alternative goal or get a new strategy asap
        if(this.goalcurrent == NULL)