void Vore_AI()
{
// main vore AI code
+ entity head;
if(!cvar("g_vore")) // the vore system is disabled
return;
// aim toward the nearest possible victim. The greater the skill, the quicker the aim
// this only does the aiming, checking and swallowing is handled below
- entity head;
head = findradius(self.origin, cvar("g_balance_vore_swallow_range"));
while(head)
{
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
+ {
+ float found_live_prey;
+ FOR_EACH_PLAYER(head)
+ {
+ if(head.predator == self)
+ if(head.deadflag != DEAD_NO)
+ found_live_prey = TRUE;
+ }
+
+ if(!found_live_prey)
+ if(self.health >= cvar("g_balance_vore_digestion_vampire_stable"))
+ self.BUTTON_REGURGITATE = TRUE;
+ }
+
// if the predator's health is smaller than the damage a stomach kick can do, regurgitate the player(s)
// otherwise the predator is putting himself at risk by keeping you inside
float kick_dmg;
kick_dmg = cvar("g_balance_vore_kick_damage");
if(cvar("g_healthsize"))
{
- entity e;
- FOR_EACH_PLAYER(e) // count the size of all players in the stomach for accounting the danger level
+ FOR_EACH_PLAYER(head) // count the size of all players in the stomach for accounting the danger level
{
- if(e.predator == self)
- if not(teamplay && e.team == self.team) // don't count team mates
- kick_dmg *= pow(e.scale / self.scale, cvar("g_balance_vore_kick_scalediff")); // based on the damage the prey can do to us at his size
+ if(head.predator == self)
+ if not(teamplay && head.team == self.team) // don't count team mates
+ if(head.deadflag != DEAD_NO) // don't count dead prey
+ kick_dmg *= pow(head.scale / self.scale, cvar("g_balance_vore_kick_scalediff")); // based on the damage the prey can do to us at his size
}
}
}
+
if(self.health <= kick_dmg)
self.BUTTON_REGURGITATE = TRUE;
-
else if(!self.digesting && cvar("g_vore_digestion"))
{
// the higher the skill, the faster bots will start to digest