]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Cvar the distance by which prey are separated in the stomach. Setting the cvar to...
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index 4dfe4a3f35b7dbed8a5abcf469a62e6a03351f8d..b44e6ec478c2af571a4c0e630f8bcc3d211c5483 100644 (file)
@@ -1,5 +1,5 @@
 .float regurgitate_prepare;\r
-.float stomachkick_delay, system_delay, swallow_delay, digest_button_delay_time, regurgitate_button_delay_time;\r
+.float stomachkick_delay, system_delay, action_delay, digest_button_delay_time, regurgitate_button_delay_time;\r
 .float complain_vore;\r
 .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload;\r
 \r
@@ -35,7 +35,7 @@ float Swallow_condition_check(entity prey)
        if(prey != self)\r
        if(prey.classname == "player" && !prey.stat_eaten && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach\r
        if(self.classname == "player" && !self.stat_eaten && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves\r
-       if(!self.BUTTON_REGURGITATE && self.swallow_delay < time)\r
+       if(!self.BUTTON_REGURGITATE && time > self.action_delay)\r
        if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
        {\r
                string swallow_complain;\r
@@ -98,17 +98,73 @@ float Vore_CanLeave()
 // position the camera properly for prey\r
 void Vore_SetCamera()\r
 {\r
-       if not(self.stat_eaten)\r
-               return;\r
+       local entity head;\r
+       local vector oldforward, oldright, oldup;\r
+       local float position_counter;\r
+       local vector origin_apply;\r
+       oldforward = v_forward;\r
+       oldright = v_right;\r
+       oldup = v_up;\r
+\r
+       makevectors(self.v_angle);\r
+       v_forward_z = 0;\r
 \r
-       self.view_ofs = PL_PREY_VIEW_OFS;\r
+       // In order to allow prey to see each other in the stomach, we must position each occupant differently,\r
+       // else all players would overlap in the center. To do this, we run a loop on all players in the same stomach.\r
+       // For each player, the origin is updated, then a new origin is used for the next player.\r
+       // This requires that no more than 9 players can be in a stomach at a time!\r
+       FOR_EACH_PLAYER(head)\r
+       {\r
+               if(head.predator == self)\r
+               {\r
+                       switch(position_counter)\r
+                       {\r
+                               case 0:\r
+                                       origin_apply = '0 0 0'; // first occupant sits in the middle\r
+                                       break;\r
+                               case 1:\r
+                                       origin_apply = '1 0 0'; // second occupant sits in the front\r
+                                       break;\r
+                               case 2:\r
+                                       origin_apply = '-1 0 0'; // third occupant sits in the back\r
+                                       break;\r
+                               case 3:\r
+                                       origin_apply = '0 1 0'; // fourth occupant sits in the right\r
+                                       break;\r
+                               case 4:\r
+                                       origin_apply = '0 -1 0'; // fifth occupant sits in the left\r
+                                       break;\r
+                               case 5:\r
+                                       origin_apply = '1 1 0'; // sixth occupant sits in the front-right\r
+                                       break;\r
+                               case 6:\r
+                                       origin_apply = '-1 1 0'; // seventh occupant sits in the back-right\r
+                                       break;\r
+                               case 7:\r
+                                       origin_apply = '1 -1 0'; // eigth occupant sits in the front-left\r
+                                       break;\r
+                               case 8:\r
+                                       origin_apply = '-1 -1 0'; // ninth occupant sits in the back-left\r
+                                       break;\r
+                               default:\r
+                                       break;\r
+                       }\r
+                       // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset\r
+                       head.view_ofs = PL_PREY_VIEW_OFS + (v_forward + origin_apply * cvar("g_vore_preydistance"));\r
+                       position_counter += 1;\r
+               }\r
+       }\r
 \r
-       float prey_height;\r
+       v_forward = oldforward;\r
+       v_right = oldright;\r
+       v_up = oldup;\r
+\r
+       /*float prey_height;\r
        if(self.fakeprey)\r
                prey_height = (self.scale - self.fakepredator.scale) * cvar("g_healthsize_vore_pos");\r
        else\r
                prey_height = (self.scale - self.predator.scale) * cvar("g_healthsize_vore_pos");\r
-       self.view_ofs_z += prey_height;\r
+       self.view_ofs_z += prey_height;*/\r
 }\r
 \r
 .float gurgle_oldstomachload;\r
@@ -194,7 +250,7 @@ void Vore_Swallow(entity e)
 \r
        // block firing for a small amount of time, or we'll be firing the next frame after we swallow\r
        e.predator.weapon_delay = time + button_delay_time;\r
-       e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
+       e.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
        e.system_delay = e.predator.system_delay = time + system_delay_time;\r
        e.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); // don't kick immediately after being swallowed\r
 }\r
@@ -229,7 +285,7 @@ void Vore_Regurgitate(entity e)
        e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle");\r
        e.predator.stomach_load -= 1;\r
        e.predator.regurgitate_prepare = 0;\r
-       e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
+       e.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
        Vore_WeightApply(e.predator);\r
 \r
        // block firing for a small amount of time, or we'll be firing the next frame\r
@@ -434,17 +490,30 @@ void Vore_AutoTaunt()
 \r
 void Vore_SetSbarRings()\r
 {\r
-       float min_time;\r
-       if(self.swallow_delay > time)\r
+       // first clear the ring stats, then configure them if needed\r
+       self.stat_sbring1_type = self.stat_sbring1_clip = 0;\r
+       self.stat_sbring2_type = self.stat_sbring2_clip = 0;\r
+\r
+       if(self.stat_eaten)\r
        {\r
-               self.stat_sbring1_type = 1; // ring shows vore system delay\r
-               min_time = self.swallow_delay - cvar("g_balance_vore_swallow_delay");\r
-               self.stat_sbring1_clip = bound(0, (time / self.swallow_delay - 1) / (min_time / self.swallow_delay - 1), 1);\r
+               if(time <= self.stomachkick_delay)\r
+               {\r
+                       self.stat_sbring1_type = 2; // ring shows stomach kick delay, empties with progress\r
+                       self.stat_sbring1_clip = bound(0, (time / self.stomachkick_delay - 1) / ((self.stomachkick_delay - cvar("g_balance_vore_kick_delay")) / self.stomachkick_delay - 1), 1);\r
+               }\r
        }\r
        else\r
        {\r
-               self.stat_sbring1_type = 0;\r
-               self.stat_sbring1_clip = 0;\r
+               if(time <= self.action_delay)\r
+               {\r
+                       self.stat_sbring1_type = 1; // ring shows vore action delay, empties with progress\r
+                       self.stat_sbring1_clip = bound(0, (time / self.action_delay - 1) / ((self.action_delay - cvar("g_balance_vore_action_delay")) / self.action_delay - 1), 1);\r
+               }\r
+               if(time <= self.regurgitate_prepare)\r
+               {\r
+                       self.stat_sbring2_type = 1; // ring shows regurgitation preparing, fills with progress\r
+                       self.stat_sbring2_clip = 1 - bound(0, (time / self.regurgitate_prepare - 1) / ((self.regurgitate_prepare - cvar("g_balance_vore_regurgitate_delay")) / self.regurgitate_prepare - 1), 1);\r
+               }\r
        }\r
 }\r
 \r
@@ -575,7 +644,7 @@ void Vore()
                self.digesting = FALSE;\r
 \r
        // predator wishes to regurgitate his prey\r
-       if(self.BUTTON_REGURGITATE)\r
+       if(self.BUTTON_REGURGITATE && time > self.action_delay)\r
        {\r
                if(self.stomach_load)\r
                {\r