From: MirceaKitsune Date: Sat, 19 Nov 2011 17:13:16 +0000 (+0200) Subject: Teach bots how to use consumable items a bit more wisely X-Git-Url: https://git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=commitdiff_plain;h=6565e0bf312d7d3c752cc5f3c9b3839e56c4f928 Teach bots how to use consumable items a bit more wisely --- diff --git a/data/qcsrc/server/bot/havocbot/vore_ai.qc b/data/qcsrc/server/bot/havocbot/vore_ai.qc index 729bd3c0..b5568904 100644 --- a/data/qcsrc/server/bot/havocbot/vore_ai.qc +++ b/data/qcsrc/server/bot/havocbot/vore_ai.qc @@ -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; }