]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/bot/havocbot/vore_ai.qc
Teach bots how to use consumable items a bit more wisely
[voretournament/voretournament.git] / data / qcsrc / server / bot / havocbot / vore_ai.qc
index 729bd3c030954ba5d3eef86d2c98ac394767e77a..b55689049c1a2c8d5e254917361575d331fb86f1 100644 (file)
@@ -182,16 +182,24 @@ void Vore_AI()
                if(self.hold_BUTTON_ATCK)
                        self.BUTTON_ATCK = TRUE;
 
-               // deciding what to do with a victim:
-
+               // deciding what to do with victims
                if(self.stomach_load && time > self.decide_pred)
                {
-                       // if the predator's stomach contains only dead prey, and he has reached the maximum amount of health
-                       // he can gain from digestion, there's no reason to keep the dead prey any longer
-                       if(cvar("g_balance_vore_digestion_limit") < 0 && skill >= 9) // such awareness comes from skill level 9 and up
+                       // if the predator's stomach contains only dead prey or items, and he has reached the maximum amount of health
+                       // he can gain from digestion, there's no reason to keep dead prey or food any longer
+                       if(skill >= 9) // such awareness comes from skill level 9 and up
                        {
+                               entity e;
+                               float consumables;
+                               for(e = world; (e = find(e, classname, "consumable")); )
+                               {
+                                       if(e.predator == self)
+                                               consumables += e.health;
+                               }
+
                                if(!Stomach_HasLivePrey(self))
-                               if(self.health >= cvar("g_balance_vore_digestion_vampire_stable"))
+                               if not(cvar("g_balance_vore_digestion_limit") < 0 && self.health < cvar("g_balance_vore_digestion_vampire_stable"))
+                               if not(consumables && self.health < min(min(g_pickup_healthsmall_max, g_pickup_healthmedium_max), min(g_pickup_healthlarge_max, g_pickup_healthmega_max)))
                                        self.BUTTON_REGURGITATE = TRUE;
                        }