]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Teach bots to use the "willingly leave" feature when available
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 7 Sep 2010 21:31:32 +0000 (00:31 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 7 Sep 2010 21:31:32 +0000 (00:31 +0300)
data/qcsrc/server/bot/havocbot/vore_ai.qc

index 28c3ec1e82ff67d3e74e84a09216e6454f540b20..e37942af61570008c85805891d3715ef58d8e3ef 100644 (file)
@@ -150,14 +150,21 @@ void Vore_AI()
 // Prey bot behavior:
 // --------------------------------
 
-       // all we can do in the stomach is kick and do some damage / try to escape
+       // all we can do in the stomach is kick and do some damage / try to escape, or leave if the circumstances allow it and we should
        if(self.eater.classname == "player" && time > self.decide_delay2)
-       if not(teams_matter && self.team == self.eater.team)
        {
-               // the higher the skill, the more the bot will kick in your stomack
-               if(skill >= random_try)
-               if not(teams_matter && prey.team == self.team) // if someone from the same team somehow made it in the belly, don't kick the eater
-                       self.BUTTON_ATCK = TRUE; // kick
+               if not(teams_matter && self.team == self.eater.team)
+               {
+                       // the higher the skill, the more the bot will kick in your stomack
+                       if(skill >= random_try)
+                       if not(teams_matter && prey.team == self.team) // if someone from the same team somehow made it in the belly, don't kick the eater
+                               self.BUTTON_ATCK = TRUE; // kick
+               }
+
+               // if a bot can willingly leave the predator, do so unless there's a reason not to
+               if(self.stat_canleave)
+               if not(teams_matter && self.team == self.eater.team && cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable")) // we are being team healed, don't leave
+                       self.BUTTON_JUMP = TRUE;
 
                self.decide_delay2 = time + decide_prey; // time before the bot decides what to do with their predator
        }