From 6565e0bf312d7d3c752cc5f3c9b3839e56c4f928 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 19 Nov 2011 19:13:16 +0200 Subject: [PATCH] Teach bots how to use consumable items a bit more wisely --- data/qcsrc/server/bot/havocbot/vore_ai.qc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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; } -- 2.39.2