]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a safety check
authorterencehill <piuntn@gmail.com>
Sun, 2 Dec 2018 16:29:59 +0000 (17:29 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 2 Dec 2018 16:29:59 +0000 (17:29 +0100)
qcsrc/server/bot/default/navigation.qc

index 8fe72ff6377d6690480eb61c7f6121e44a5cd32d..6c5e2769b4c6e3d070e91b64258e1373adf2fe55 100644 (file)
@@ -1808,15 +1808,17 @@ void navigation_goalrating_end(entity this)
        LOG_DEBUG("best goal ", this.goalcurrent.classname);
 
        // If the bot got stuck then try to reach the farthest waypoint
-       if (!this.goalentity && autocvar_bot_wander_enable)
+       if (!this.goalentity)
        {
-               if (!(this.aistatus & AI_STATUS_STUCK))
+               if (autocvar_bot_wander_enable && !(this.aistatus & AI_STATUS_STUCK))
                {
                        LOG_DEBUG(this.netname, " cannot walk to any goal");
                        this.aistatus |= AI_STATUS_STUCK;
                }
+               this.goalentity_shouldbefrozen = false;
        }
-       this.goalentity_shouldbefrozen = boolean(STAT(FROZEN, this.goalentity));
+       else
+               this.goalentity_shouldbefrozen = boolean(STAT(FROZEN, this.goalentity));
 }
 
 void botframe_updatedangerousobjects(float maxupdate)