]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Avoid rating all the items repeatedly when a bot reaches an item that is about to...
authorterencehill <piuntn@gmail.com>
Tue, 24 Jan 2017 21:43:19 +0000 (22:43 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 24 Jan 2017 21:43:19 +0000 (22:43 +0100)
qcsrc/server/bot/default/bot.qh
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/navigation.qc

index f615c040360f7f2bbbc85f296137c60c1c8c2765..b72fad9bd600248601794130a2cf0f505c110991 100644 (file)
@@ -62,6 +62,7 @@ entity bot_list;
 
 .float bot_pickup;
 .float bot_pickupbasevalue;
+.bool bot_pickup_respawning;
 .float bot_canfire;
 .float bot_strategytime;
 
index 1efdab0d3433212936ed61e5a9176b64889ee65a..5c25806365f367d1b3337cbae77b1231018282aa 100644 (file)
@@ -38,6 +38,8 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
 
                        if(time < it.scheduledrespawntime - t)
                                continue;
+
+                       it.bot_pickup_respawning = true;
                }
                o = (it.absmin + it.absmax) * 0.5;
                if(vdist(o - org, >, sradius) || (it == this.ignoregoal && time < this.ignoregoaltime) )
index 4c8982e9457a22d9614a6d4aed2d2bec00ab46fa..d6bb2195f64ea9d4a3248f88bc5ec2f55e668f6f 100644 (file)
@@ -897,6 +897,13 @@ void navigation_poptouchedgoals(entity this)
                }
        }
 
+       if(this.goalcurrent.bot_pickup_respawning)
+       {
+               if(!this.goalcurrent.solid)
+                       return;
+               this.goalcurrent.bot_pickup_respawning = false;
+       }
+
        // If for some reason the bot is closer to the next goal, pop the current one
        if(this.goalstack01 && !wasfreed(this.goalstack01))
        if(vlen2(this.goalcurrent.origin - this.origin) > vlen2(this.goalstack01.origin - this.origin))