+.float status_teamhealing; // 0 = can't team heal, 1 = can team heal, 2 = team healing currently
+
entity Swallow_distance_check_bot(entity e)
{
// check if we can swallow a player instead of firing our weapon
void Vore_AI_Teamheal(entity prey)
{
+ // allows bots to take advantage of the teamheal feature in team games, and use this feature to heal damaged team mates
+
if not(teamplay)
return;
- // check if we can heal a damaged team mate we came across, and if so swallow them
- if(prey.classname == "player" && prey.team == self.team)
- if(Swallow_condition_check_bot(prey))
- if(prey.health < cvar("g_balance_vore_teamheal_stable"))
- self.BUTTON_ATCK = TRUE; // swallow
+ self.status_teamhealing = 1; // start from the premise we can teamheal until proven otherwise
+ if(self.deadflag != DEAD_NO || self.eater.classname == "player")
+ self.status_teamhealing = 0;
// if we are holding a team mate that's been healed to the max, we can release them
+ // also use this check to not go any further if someone from the enemy team is in our stomach
entity head;
if(self.stomach_load)
{
FOR_EACH_PLAYER(head)
{
if(head.eater.classname == "player")
- if(head.team == self.team)
- if(head.health >= cvar("g_balance_vore_teamheal_stable"))
- self.BUTTON_REGURGITATE = TRUE;
+ {
+ if(head.team == self.team)
+ {
+ if(head.health >= cvar("g_balance_vore_teamheal_stable"))
+ self.BUTTON_REGURGITATE = TRUE; // release the team mate
+ }
+ else
+ {
+ self.status_teamhealing = 0; // someone from the enemy team is in our belly, which means we can't be teamhealing any more
+ return;
+ }
+ }
}
}
+
+ // check if we can heal a damaged team mate we came across, and if so swallow them
+ if(self.status_teamhealing)
+ if(prey.classname == "player" && prey.team == self.team)
+ if not(prey.flagcarried) // don't eat the flag carrier and ruin his job
+ if(Swallow_condition_check_bot(prey))
+ if(prey.health < cvar("g_balance_vore_teamheal_stable"))
+ {
+ self.BUTTON_ATCK = TRUE; // swallow
+ self.status_teamhealing = 2;
+ }
}
.float swallow_retry, decide_delay1, decide_delay2;
}
Vore_AI_Teamheal(prey);
+ if(self.status_teamhealing > 1) // if we are teamhealing, there's nothing to do from here on
+ return;
// deciding what to do with a victim: