]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow bots to run to powerups and megas a little time before they respawn
authorterencehill <piuntn@gmail.com>
Fri, 20 Jan 2017 18:42:13 +0000 (19:42 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 20 Jan 2017 18:42:13 +0000 (19:42 +0100)
qcsrc/server/bot/default/havocbot/roles.qc

index f57a18fed6c39a1bb4a5d7b3e63506996d817d13..ebdca2d8923d215dde55c6bc74a05f0180074bc8 100644 (file)
@@ -23,8 +23,24 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
        {
                rating = 0;
 
+               if(!it.solid)
+               {
+                       if(!it.scheduledrespawntime)
+                               continue;
+                       if(it.respawntime < 30 || (it.respawntimejitter && !it.itemdef.instanceOfPowerup))
+                               continue;
+
+                       float t = 0;
+                       if(it.itemdef.instanceOfPowerup)
+                               t = bound(0, skill / 10, 1) * 6;
+                       else if(skill >= 9)
+                               t = 4;
+
+                       if(time < it.scheduledrespawntime - t)
+                               continue;
+               }
                o = (it.absmin + it.absmax) * 0.5;
-               if(!it.solid || vdist(o - org, >, sradius) || (it == this.ignoregoal && time < this.ignoregoaltime) )
+               if(vdist(o - org, >, sradius) || (it == this.ignoregoal && time < this.ignoregoaltime) )
                        continue;
 
                // Check if the item can be picked up safely