]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: avoid anticipating a new goal search if current final goal is close enough
authorterencehill <piuntn@gmail.com>
Wed, 20 Jun 2018 16:23:16 +0000 (18:23 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 20 Jun 2018 16:23:16 +0000 (18:23 +0200)
qcsrc/server/bot/default/navigation.qc

index 4665be482a69287c8eb0d3d46b4b292e226f7717..2bf1fda728089de3cbd68e90fc5bc961fee129e8 100644 (file)
@@ -49,12 +49,15 @@ bool navigation_goalrating_timeout(entity this)
 #define MAX_CHASE_DISTANCE 700
 bool navigation_goalrating_timeout_can_be_anticipated(entity this)
 {
-       if(time > this.bot_strategytime - (IS_MOVABLE(this.goalentity) ? 3 : 2))
+       vector gco = (this.goalentity.absmin + this.goalentity.absmax) * 0.5;
+       if (vdist(gco - this.origin, >, autocvar_sv_maxspeed * 1.5)
+               && time > this.bot_strategytime - (IS_MOVABLE(this.goalentity) ? 3 : 2))
+       {
                return true;
+       }
 
        if (this.goalentity.bot_pickup && time > this.bot_strategytime - 5)
        {
-               vector gco = (this.goalentity.absmin + this.goalentity.absmax) * 0.5;
                if(!havocbot_goalrating_item_pickable_check_players(this, this.origin, this.goalentity, gco))
                {
                        this.ignoregoal = this.goalentity;