]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/bot/havocbot/vore_ai.qc
Share some duplicated code instead
[voretournament/voretournament.git] / data / qcsrc / server / bot / havocbot / vore_ai.qc
index 3e74edff9285891caaa53abd529950576f241067..dbe702b300cc9f8ef45eb8087cd0fc979b16ba5b 100644 (file)
@@ -1,22 +1,9 @@
-.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
-       vector w_shotorg, w_shotdir;
-       w_shotorg = self.origin + self.view_ofs;
-       w_shotdir = v_forward;
-
-       WarpZone_traceline_antilag(e, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, e, ANTILAG_LATENCY(e));
-       if(trace_fraction < 1)
-       if(trace_ent.classname == "player")
-               return trace_ent;
-       return world;
-}
+.float status_teamhealing; // 0 = can't team heal, 1 = can team heal, 2 = team healing right now
 
 float Swallow_condition_check_bot(entity prey)
 {
        // checks the necessary conditions for a bot to swallow another player
+
        if(prey != self && prey.classname == "player" && prey.predator.classname != "player" && prey.deadflag == DEAD_NO && !prey.BUTTON_CHAT) // we can't swallow someone who's already in someone else's stomach
        if(self.predator.classname != "player" && self.stomach_load < cvar("g_balance_vore_swallow_limit") && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves
        if not(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load)
@@ -110,7 +97,7 @@ void Vore_AI()
        float random_try;
        float decide_prey, decide_pred;
 
-       prey = Swallow_distance_check_bot(self);
+       prey = Swallow_player_check();
 
        // check if we should run the Teamhealing AI rather than continuing with the normal vore
        Vore_AI_Teamheal(prey);