]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Share some duplicated code instead
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 9 Sep 2010 11:48:39 +0000 (14:48 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 9 Sep 2010 11:48:39 +0000 (14:48 +0300)
data/qcsrc/server/bot/havocbot/vore_ai.qc
data/qcsrc/server/vore.qc
data/qcsrc/server/vore.qh

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);
index fdbff4d971d80e0603d17ae216d2f7ec34f33632..ea2e82b13330ef3f7bbcb8f11253c6783946dc6b 100644 (file)
@@ -8,7 +8,7 @@ const float complain_delay_time = 1;
 const float button_delay_time = 0.5;\r
 const float steptime = 0.1;\r
 \r
-entity Swallow_distance_check()\r
+entity Swallow_player_check()\r
 {\r
        // check if we can swallow a player instead of firing our weapon\r
 \r
@@ -331,7 +331,7 @@ void Vore()
 // --------------------------------\r
 \r
        entity prey;\r
-       prey = Swallow_distance_check();\r
+       prey = Swallow_player_check();\r
 \r
        // attempt to swallow our new prey if we pressed the attack button, and there's any in range\r
        if(self.BUTTON_ATCK && !self.BUTTON_REGURGITATE && self.swallow_delay < time)\r
index 5d7c6625829c71250c0fd5a99ed4d13bb80df8de..dc55cd1386a29ec2b84aa103215874f99f24b25e 100644 (file)
@@ -1,2 +1,3 @@
 void Vore();\r
-void Vore_Disconnect();
\ No newline at end of file
+void Vore_Disconnect();\r
+entity Swallow_player_check();
\ No newline at end of file