]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Properly set and update the swallow model
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index b3fd18fd7a71fdcfb8d38eb84566067b71656686..01c58f3704a90593f6dcecfeb29a3cf136ff2ded 100644 (file)
@@ -1,5 +1,5 @@
 .float regurgitate_prepare;\r
-.float 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
@@ -12,11 +12,16 @@ entity Swallow_player_check()
 {\r
        // check if we can swallow a player instead of firing our weapon\r
 \r
-       vector w_shotorg, w_shotdir;\r
-       w_shotorg = self.origin + self.view_ofs;\r
-       w_shotdir = v_forward;\r
+       float swallow_range;\r
+       vector vore_w_shotorg, vore_w_shotdir;\r
 \r
-       WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self));\r
+       swallow_range = cvar("g_balance_vore_swallow_range");\r
+       if(self.scale) // we can swallow from further or closer based on our size\r
+               swallow_range *= self.scale;\r
+       vore_w_shotorg = self.origin;\r
+       vore_w_shotdir = v_forward;\r
+\r
+       WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * swallow_range, FALSE, self, ANTILAG_LATENCY(self));\r
        if(trace_fraction < 1)\r
        if(trace_ent.classname == "player")\r
                return trace_ent;\r
@@ -28,53 +33,57 @@ float Swallow_condition_check(entity prey)
        // checks the necessary conditions for swallowing a player\r
 \r
        if(prey != self)\r
-       if(prey.classname == "player" && prey.predator.classname != "player" && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach\r
-       if(self.classname == "player" && self.predator.classname != "player" && 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(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 && time > self.action_delay)\r
        if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
        {\r
+               string swallow_complain;\r
                if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore"))\r
+                       swallow_complain = "You cannot swallow your team mates\n";\r
+               else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time)\r
+                       swallow_complain = "You cannot swallow someone protected by the spawn shield\n";\r
+               else if(self.stomach_load >= g_balance_vore_swallow_limit)\r
+                       swallow_complain = strcat("You cannot swallow more than ^2", ftos(g_balance_vore_swallow_limit), "^7 players at a time\n");\r
+               else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load)\r
+                       swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n";\r
+               else if(cvar("g_vore_biggersize") && prey.scale > self.scale)\r
+                       swallow_complain = "You cannot swallow someone larger than you\n";\r
+\r
+               if(swallow_complain != "")\r
                {\r
-                       if(time > self.complain_vore)\r
+                       if(time > self.complain_vore && self.BUTTON_ATCK)\r
                        {\r
-                               play2(self, "misc/unavailable.wav");\r
-                               sprint(self, "You cannot swallow your team mates\n");\r
+                               play2(self, "misc/forbidden.wav");\r
+                               sprint(self, swallow_complain);\r
                                self.complain_vore = time + complain_delay_time;\r
                        }\r
                        return FALSE;\r
                }\r
+               return TRUE;\r
+       }\r
+       return FALSE;\r
+}\r
 \r
-               if(self.stomach_load >= cvar("g_balance_vore_swallow_limit"))\r
-               {\r
-                       if(time > self.complain_vore)\r
-                       {\r
-                               play2(self, "misc/unavailable.wav");\r
-                               sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"));\r
-                               self.complain_vore = time + complain_delay_time;\r
-                       }\r
-                       return FALSE;\r
-               }\r
+float Stomach_TeamMates_check(entity pred)\r
+{\r
+       // checks if a player's stomach contains any team mates\r
 \r
-               if(cvar("g_vore_biggergut"))\r
-               if(prey.stomach_load > self.stomach_load)\r
+       entity head;\r
+       if(teams_matter)\r
+       {\r
+               FOR_EACH_PLAYER(head)\r
                {\r
-                       if(time > self.complain_vore)\r
-                       {\r
-                               play2(self, "misc/unavailable.wav");\r
-                               sprint(self, "You cannot swallow someone with a bigger stomach than yours\n");\r
-                               self.complain_vore = time + complain_delay_time;\r
-                       }\r
-                       return FALSE;\r
+                       if(head.predator == pred && head.team == pred.team)\r
+                               return TRUE;\r
                }\r
-\r
-               return TRUE;\r
        }\r
        return FALSE;\r
 }\r
 \r
 float Vore_CanLeave()\r
 {\r
-       if(self.predator.classname == "player")\r
+       if(self.stat_eaten)\r
        {\r
                if(!cvar("g_vore_kick")) // you are defenseless in the stomach if you can't kick, so allow leaving\r
                        return TRUE;\r
@@ -86,34 +95,68 @@ float Vore_CanLeave()
        return FALSE;\r
 }\r
 \r
-// make the camera smoothly lower itself when we get swallowed\r
-// our aim is going from the normal view offset to half of the view offset (because half is the best positioning for the stomach model)\r
-.float cameraeffect_current, cameraeffect_target;\r
-void Vore_CameraEffect_Set(entity e)\r
+// position the camera properly for prey\r
+void Vore_SetPreyPositions()\r
 {\r
-       e.cameraeffect_current = 1;\r
-       e.cameraeffect_target = 2;\r
-}\r
-void Vore_CameraEffect_Apply()\r
-{\r
-       if(self.predator.classname != "player")\r
-               return;\r
+       // self is the predator and head is the prey\r
 \r
-       if(self.cvar_cl_vore_cameraspeed)\r
+       local entity head;\r
+       local vector origin_apply;\r
+       local float position_counter;\r
+\r
+       // In order to allow prey to see each other in the stomach, we must position each occupant differently,\r
+       // else all players 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 may be in the stomach at a time!\r
+       FOR_EACH_PLAYER(head)\r
        {\r
-               local float step;\r
-               step = self.cvar_cl_vore_cameraspeed * frametime;\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
 \r
-               // not sure if these maths are good, as the effect should be smoother\r
-               if(self.cameraeffect_current >= self.cameraeffect_target + step)\r
-                       self.cameraeffect_current -= step;\r
-               else if(self.cameraeffect_current <= self.cameraeffect_target - step)\r
-                       self.cameraeffect_current += step;\r
-       }\r
-       else\r
-               self.cameraeffect_current = self.cameraeffect_target;\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 + origin_apply * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_z *= self.scale; // stomach center depends on predator scale\r
+\r
+                       // change prey height based on scale\r
+                       float prey_height;\r
+                               prey_height = (head.scale - self.scale) * cvar("g_healthsize_vore_pos");\r
+                       head.view_ofs_z += prey_height;\r
 \r
-       self.view_ofs_z = PL_VIEW_OFS_z / self.cameraeffect_current;\r
+                       position_counter += 1;\r
+               }\r
+       }\r
 }\r
 \r
 .float gurgle_oldstomachload;\r
@@ -144,25 +187,67 @@ void Vore_AutoDigest(entity e)
 {\r
        // if the predator has the autodigest preference enabled, begin digesting new prey automatically\r
 \r
-       if not(cvar("g_vore_digestion"))\r
+       if(!cvar("g_vore_digestion") || e.digesting)\r
                return;\r
-       if not(e.cvar_cl_vore_autodigest)\r
+       if(!e.cvar_cl_vore_autodigest || clienttype(e) != CLIENTTYPE_REAL)\r
+               return; // this feature is only for players, not bots\r
+       if(e.stomach_load > 1)\r
+               return; // don't start digestion if we already ate someone, as that means we manually disabled it after the first prey and want it off\r
+       if(Stomach_TeamMates_check(e))\r
+               return; // never begin automatic digestion if we've swallowed a team mate\r
+\r
+       e.digesting = TRUE;\r
+}\r
+\r
+void Vore_SwallowModel_Think()\r
+{\r
+       //update the necessary angles to match our view\r
+       self.angles_x = self.owner.angles_x;\r
+       self.view_ofs = self.owner.view_ofs;\r
+       self.alpha = self.owner.cvar_cl_vore_stomachmodel;\r
+\r
+       // if our swallow progress is gone, the swallow model must also go\r
+       /*if(!self.owner.swallow_progress_prey)\r
+       {\r
+               self.nextthink = 0;\r
+               remove(self);\r
+               self = world;\r
                return;\r
-       if(clienttype(e) != CLIENTTYPE_REAL)\r
-               return; // this feature is only for players\r
+       }*/\r
 \r
-       entity head;\r
-       if(teams_matter)\r
+       self.nextthink = time;\r
+}\r
+\r
+.entity swallow_model;\r
+void Vore_SwallowModel_Update(entity prey)\r
+{\r
+       // if we don't have a swallow model already, spawn one\r
+       if(!prey.swallow_model)\r
        {\r
-               FOR_EACH_PLAYER(head)\r
-               {\r
-                       // never begin automatic digestion if we've swallowed a team mate\r
-                       if(head.predator == e && head.team == e.team)\r
-                               return;\r
-               }\r
+               prey.swallow_model = spawn();\r
+               \r
+               prey.swallow_model.movetype = MOVETYPE_FOLLOW;\r
+               prey.swallow_model.solid = SOLID_NOT;\r
+\r
+               prey.swallow_model.skin = self.skin;\r
+               prey.swallow_model.scale = self.scale;\r
+\r
+               // apply the properties of the prey\r
+               prey.swallow_model.aiment = prey;\r
+\r
+               prey.swallow_model.owner = prey; // owned by the prey\r
+               prey.swallow_model.enemy = self; // enemy is the predator\r
+               prey.swallow_model.think = Vore_SwallowModel_Think;\r
+               prey.swallow_model.nextthink = time;\r
        }\r
 \r
-       e.digesting = TRUE;\r
+       // if the model or skin of the prey's swallow model don't match those of our current predator, change them\r
+       string swallow_mdl;\r
+       swallow_mdl = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_swallow.md3"); // 4 is the extension length\r
+       if(prey.swallow_model.model != swallow_mdl)\r
+               setmodel(prey.swallow_model, swallow_mdl);\r
+       if(prey.swallow_model.skin != self.skin)\r
+               prey.swallow_model.skin = self.skin;\r
 }\r
 \r
 .entity pusher;\r
@@ -179,7 +264,6 @@ void Vore_Swallow(entity e)
        e.velocity = '0 0 0';\r
        e.movetype = MOVETYPE_FOLLOW;\r
        e.solid = SOLID_NOT;\r
-       e.alpha = -1; // best way of hiding the eaten player\r
        e.aiment = e.predator; // follow the predator, automatically unset when regurgitated\r
 \r
        // drop keys (KH) and flags (CTF) when we get swallowed\r
@@ -187,20 +271,20 @@ void Vore_Swallow(entity e)
        if(e.flagcarried)\r
                DropFlag(e.flagcarried, world, e.predator);\r
 \r
-       Vore_CameraEffect_Set(e);\r
-\r
        if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
                e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release"));\r
 \r
        if(teams_matter && e.team == e.predator.team)\r
        {\r
-               centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
-               centerprint(e.predator, "^3You have swallowed a team mate, use caution!");\r
+               if(cvar("g_vore_kick"))\r
+                       centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
+               if(cvar("g_vore_digestion"))\r
+                       centerprint(e.predator, "^3You have swallowed a team mate, don't digest!");\r
        }\r
 \r
-       PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
+       PlayerSound(e.predator, playersound_swallow, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
        setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
-       e.predator.punchangle_x -= e.predator.cvar_cl_vore_punchangle;\r
+       e.predator.punchangle_x -= cvar("g_balance_vore_swallow_punchangle");\r
        e.predator.stomach_load += 1;\r
        e.predator.regurgitate_prepare = 0;\r
        e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
@@ -209,8 +293,41 @@ 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
+\r
+void Vore_SwallowStep(entity e)\r
+{\r
+       if(!cvar("g_balance_vore_swallow_speed_fill"))\r
+       {\r
+               Vore_Swallow(e);\r
+               return;\r
+       }\r
+\r
+       Vore_SwallowModel_Update(e);\r
+\r
+       // increase the progress value until it reaches 1, then swallow the player\r
+       if(e.swallow_progress_prey < 1)\r
+       {\r
+               float fill;\r
+               fill = cvar("g_balance_vore_swallow_speed_fill") * frametime;\r
+               if(cvar("g_balance_vore_swallow_speed_fill_scalediff")) // fill rate depends on predator size compared to prey size\r
+                       fill *= (self.scale / e.scale);\r
+               if(cvar("g_balance_vore_swallow_speed_fill_stomachload") && e.stomach_load) // fill rate is influenced by the prey's stomach load\r
+                       fill /= e.stomach_load;\r
+\r
+               e.swallow_progress_prey += fill;\r
+       }\r
+       else\r
+       {\r
+               Vore_Swallow(e);\r
+               e.swallow_progress_prey = 0;\r
+       }\r
+\r
+       // the predator's progress is how much the prey got swallowed\r
+       self.swallow_progress_pred = e.swallow_progress_prey;\r
 }\r
 \r
 void Vore_Regurgitate(entity e)\r
@@ -221,7 +338,6 @@ void Vore_Regurgitate(entity e)
        if(e.health > 0) // leave SOLID_NOT for dead bodies\r
                e.solid = e.vore_oldsolid;\r
        e.view_ofs_z = PL_VIEW_OFS_z;\r
-       e.alpha = default_player_alpha;\r
 \r
        // apply velocities\r
        local vector oldforward, oldright, oldup;\r
@@ -238,13 +354,17 @@ void Vore_Regurgitate(entity e)
        e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits\r
        e.pushltime = time + cvar("g_maxpushtime");\r
 \r
-       PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
+       // regurgitated prey is given this amount of swallow progress, to simulate being more vulnerable\r
+       if(cvar("g_balance_vore_swallow_speed_fill"))\r
+               e.swallow_progress_prey = cvar("g_balance_vore_regurgitate_swallowprogress");\r
+\r
+       PlayerSound(e.predator, playersound_regurgitate, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
        setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
        pointparticles(particleeffectnum("regurgitate"), e.predator.origin, '0 0 0', 1);\r
-       e.predator.punchangle_x += e.predator.cvar_cl_vore_punchangle;\r
+       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
@@ -257,7 +377,7 @@ void Vore_DeadPrey_Configure(entity e)
 {\r
        // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying\r
 \r
-       if(e.fakeprey || e.predator.classname != "player") // already configured\r
+       if(e.fakeprey || !e.stat_eaten) // we already configured everything\r
                return;\r
 \r
        // this entity is like e.predator but for dead prey, to avoid conflicts\r
@@ -275,9 +395,6 @@ void Vore_DeadPrey_Configure(entity e)
        e.takedamage = DAMAGE_NO;\r
        e.solid = SOLID_NOT;\r
        e.aiment = e.fakepredator;\r
-\r
-       // completely remove the dead body\r
-       e.alpha = -1;\r
 }\r
 \r
 void Vore_DeadPrey_Detach(entity e)\r
@@ -289,25 +406,29 @@ void Vore_DeadPrey_Detach(entity e)
                return;\r
 \r
        e.fakepredator = world;\r
+       e.fakeprey = TRUE; // keep fakeprey status\r
+       e.stat_eaten = 0;\r
        e.aiment = world;\r
-\r
-       if(!e.deadflag)\r
-               e.fakeprey = FALSE;\r
+       e.movetype = MOVETYPE_TOSS;\r
 }\r
 \r
-void Vore_PreyRelease(entity e)\r
+void Vore_PreyRelease(entity e, float pred_disconnect)\r
 {\r
-       // if the keepdeadprey feature is on, don't spit a dead prey's carcass out\r
-       if(e.health <= 0 && cvar("g_vore_keepdeadprey"))\r
+       if(pred_disconnect)\r
        {\r
-               Vore_DeadPrey_Configure(e);\r
-\r
-               // if keepdeadprey is enabled and the predator disconnected, detach the dead prey\r
-               if(e.fakepredator.classname != "player")\r
+               if(e.fakeprey)\r
                        Vore_DeadPrey_Detach(e);\r
+               else\r
+                       Vore_Regurgitate(e);\r
+       }\r
+       else if(self.stat_eaten && !self.fakeprey)\r
+       {\r
+               // if the keepdeadprey feature is on, don't spit a dead prey's carcass out\r
+               if(e.deadflag != DEAD_NO && random() < cvar("g_vore_keepdeadprey"))\r
+                       Vore_DeadPrey_Configure(e);\r
+               else\r
+                       Vore_Regurgitate(e);\r
        }\r
-       else\r
-               Vore_Regurgitate(e);\r
 }\r
 \r
 void Vore_Disconnect()\r
@@ -315,20 +436,17 @@ void Vore_Disconnect()
        // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances\r
 \r
        // prey disconnects or goes spectating while inside someone's belly\r
-       if(self.predator.classname == "player")\r
-               Vore_PreyRelease(self);\r
+       if(self.stat_eaten)\r
+               Vore_PreyRelease(self, TRUE);\r
 \r
        // pred disconnects or goes spectating with players in their belly\r
-       else if(self.stomach_load > 0)\r
+       entity head;\r
+       FOR_EACH_PLAYER(head)\r
        {\r
-               entity head;\r
-               FOR_EACH_PLAYER(head)\r
-               {\r
-                       if(head.predator == self)\r
-                               Vore_PreyRelease(head);\r
-               }\r
-               Vore_GurgleSound(); // stop the gurgling sound\r
+               if(head.predator == self || head.fakepredator == self)\r
+                       Vore_PreyRelease(head, TRUE);\r
        }\r
+       Vore_GurgleSound(); // stop the gurgling sound\r
 \r
        self.stomach_load = self.gravity = 0; // prevents a bug\r
 }\r
@@ -338,21 +456,35 @@ void Vore_Digest()
 {\r
        // apply digestion to prey\r
 \r
-       if(time > self.predator.digestion_step)\r
+       if(time > self.digestion_step)\r
        {\r
-               Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0');\r
+               // if distributed digestion is enabled, reduce digestion strength by the number of prey in our stomach\r
+               float reduce;\r
+               if(cvar("g_balance_vore_digestion_distribute"))\r
+                       reduce = self.predator.stomach_load;\r
+               else\r
+                       reduce = 1;\r
+\r
+               float damage;\r
+               damage = cvar("g_balance_vore_digestion_damage") / reduce;\r
+\r
+               // apply player scale to digestion damage\r
+               if(cvar("g_balance_vore_digestion_scalediff"))\r
+                       damage *= (self.predator.scale / self.scale);\r
+\r
+               Damage(self, self.predator, self.predator, damage, DEATH_DIGESTION, self.origin, '0 0 0');\r
                if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable"))\r
-                       self.predator.health += cvar("g_balance_vore_digestion_vampire");\r
+                       self.predator.health += cvar("g_balance_vore_digestion_vampire") / reduce;\r
 \r
                if (self.predator.digestsound_finished < time)\r
                {\r
                        PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
                        self.predator.digestsound_finished = time + 0.5;\r
                }\r
-               self.predator.digestion_step = time + steptime;\r
+               self.digestion_step = time + steptime;\r
        }\r
 \r
-       if(self.health <= 0)\r
+       if(self.deadflag != DEAD_NO)\r
        if(stov(cvar_string("g_vore_regurgitatecolor_digest")))\r
                self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digest"));\r
 }\r
@@ -367,10 +499,16 @@ void Vore_Teamheal()
        {\r
                self.health += cvar("g_balance_vore_teamheal");\r
                self.teamheal_step = time + steptime;\r
+\r
+               // play beep sound when a team mate was healed to the maximum amount, to both the prey and the predator\r
+               if(self.health >= cvar("g_balance_vore_teamheal_stable"))\r
+               {\r
+                       play2(self, "misc/beep.wav");\r
+                       play2(self.predator, "misc/beep.wav");\r
+               }\r
        }\r
 }\r
 \r
-.float stomachkick_delay;\r
 void Vore_StomachKick()\r
 {\r
        // allows prey to kick the predator's stomach and do some damage or attempt to escape\r
@@ -378,12 +516,25 @@ void Vore_StomachKick()
        if(time > self.stomachkick_delay)\r
        {\r
                float damage;\r
+               vector force;\r
                damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min"));\r
-               Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * cvar("g_balance_vore_kick_force"));\r
-               sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);\r
+               force = v_forward * cvar("g_balance_vore_kick_force");\r
+\r
+               // apply player scale to the damage / force of the kick\r
+               if(cvar("g_balance_vore_kick_scalediff"))\r
+               {\r
+                       damage *= (self.scale / self.predator.scale);\r
+                       force *= (self.scale / self.predator.scale);\r
+               }\r
 \r
-               if(random() < cvar("g_balance_vore_kick_escapeprobability"))\r
-                       Vore_Regurgitate(self);\r
+               Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, force);\r
+               sound(self.predator, CHAN_PROJECTILE, strcat("weapons/hit", ftos(floor(random() * 8)), ".wav"), VOL_BASE, ATTN_NORM);\r
+               self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle");\r
+               self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle");\r
+\r
+               // abort the predator's scheduled regurgitation\r
+               if(random() < cvar("g_balance_vore_kick_cutregurgitate"))\r
+                       self.predator.regurgitate_prepare = 0;\r
 \r
                self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay");\r
        }\r
@@ -397,12 +548,89 @@ void Vore_StomachLeave()
                Vore_Regurgitate(self);\r
        else if(time > self.complain_vore)\r
        {\r
-               play2(self, "misc/unavailable.wav");\r
+               play2(self, "misc/forbidden.wav");\r
                sprint(self, strcat("You cannot get out of ", self.predator.netname, "\n"));\r
                self.complain_vore = time + complain_delay_time;\r
        }\r
 }\r
 \r
+void Vore_AutoTaunt()\r
+{\r
+       // triggers ambient vore taunts, for both pred and prey\r
+\r
+       float taunt_time;\r
+\r
+       // predator taunts\r
+       if(self.stomach_load && !Stomach_TeamMates_check(self))\r
+       {\r
+               if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
+               {\r
+                       taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min");\r
+                       SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPRED);\r
+               }\r
+       }\r
+       else if(self.taunt_soundtype == TAUNTTYPE_VOREPRED)\r
+       {\r
+               // we have a predator taunt scheduled, but are no longer a (suitable) predator, so remove it\r
+               SetAutoTaunt(self, 0, 0);\r
+       }\r
+\r
+       // prey taunts\r
+       if(self.stat_eaten && !(teams_matter && self.team == self.predator.team))\r
+       {\r
+               if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
+               {\r
+                       taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min");\r
+                       SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPREY);\r
+               }\r
+       }\r
+       else if(self.taunt_soundtype == TAUNTTYPE_VOREPREY)\r
+       {\r
+               // we have a prey taunt scheduled, but are no longer a (suitable) prey, so remove it\r
+               SetAutoTaunt(self, 0, 0);\r
+       }\r
+}\r
+\r
+void Vore_SetSbarRings()\r
+{\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
+               if(time <= self.stomachkick_delay)\r
+               {\r
+                       self.stat_sbring1_type = 3; // 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
+               if(self.swallow_progress_pred)\r
+               {\r
+                       self.stat_sbring1_type = 1; // ring shows predator swallow progress, fills with progress\r
+                       self.stat_sbring1_clip = bound(0, self.swallow_progress_pred, 1);\r
+               }\r
+               else if(time <= self.action_delay)\r
+               {\r
+                       self.stat_sbring1_type = 2; // 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
+\r
+               if(self.swallow_progress_prey)\r
+               {\r
+                       self.stat_sbring2_type = 1; // ring shows prey swallow progress, fills with progress\r
+                       self.stat_sbring2_clip = bound(0, self.swallow_progress_prey, 1);\r
+               }\r
+               else if(time <= self.regurgitate_prepare)\r
+               {\r
+                       self.stat_sbring2_type = 2; // 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
 void Vore()\r
 {\r
        // main vore code, this is where it all happens\r
@@ -413,8 +641,10 @@ void Vore()
                return;\r
        }\r
 \r
+       Vore_AutoTaunt();\r
+\r
        // wash the goo away from players once they leave the stomach\r
-       if(self.predator.classname != "player")\r
+       if(!self.stat_eaten)\r
        if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
        if(self.colormod)\r
        if(cvar("g_vore_regurgitatecolor_release_fade"))\r
@@ -430,8 +660,11 @@ void Vore()
                        self.colormod_z = 1;\r
        }\r
 \r
-       // set all vore related stats\r
-       if(self.predator.classname == "player")\r
+       // set all vore stats\r
+       Vore_SetSbarRings();\r
+       if(self.fakepredator.classname == "player")\r
+               self.stat_eaten = num_for_edict(self.fakepredator);\r
+       else if(self.predator.classname == "player")\r
        {\r
                self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board\r
                self.stat_digesting = self.predator.digesting; // necessary for the stomach board\r
@@ -448,7 +681,7 @@ void Vore()
        // don't allow a player inside a player inside another player :)\r
        // prevent this by checking if such has happened, and taking the proper measures\r
        // this code has a high priority and must not be stopped by any delay, so run it here\r
-       if(self.predator.predator.classname == "player")\r
+       if(self.predator.stat_eaten)\r
        {\r
                entity target_predator, target_predator_predator, oldself;\r
                target_predator = self.predator;\r
@@ -469,6 +702,23 @@ void Vore()
                }\r
        }\r
 \r
+       // the swallow progress of prey and preds idly decrease by this amount\r
+       if(cvar("g_balance_vore_swallow_speed_decrease"))\r
+       {\r
+               if(self.swallow_progress_pred)\r
+               {\r
+                       self.swallow_progress_pred -= cvar("g_balance_vore_swallow_speed_decrease") * frametime;\r
+                       if(self.swallow_progress_pred < 0)\r
+                               self.swallow_progress_pred = 0;\r
+               }\r
+               if(self.swallow_progress_prey)\r
+               {\r
+                       self.swallow_progress_prey -= cvar("g_balance_vore_swallow_speed_decrease") * frametime;\r
+                       if(self.swallow_progress_prey < 0)\r
+                               self.swallow_progress_prey = 0;\r
+               }\r
+       }\r
+\r
        // apply delays and skip the vore system under some circumstances\r
        if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins\r
        {\r
@@ -488,9 +738,20 @@ void Vore()
        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)\r
+       self.stat_canswallow = 0;\r
        if(Swallow_condition_check(prey))\r
-               Vore_Swallow(prey);\r
+       {\r
+               // canswallow stat, used by the HUD\r
+               if(teams_matter && prey.team == self.team)\r
+                       self.stat_canswallow = 2;\r
+               else\r
+                       self.stat_canswallow = 1;\r
+\r
+               if(self.BUTTON_ATCK)\r
+                       Vore_SwallowStep(prey);\r
+       }\r
+       else if(prey != world)\r
+               self.stat_canswallow = -1;\r
 \r
        // toggle digestion, if the player has someone in their stomach\r
        if(self.BUTTON_DIGEST && cvar("g_vore_digestion"))\r
@@ -505,7 +766,7 @@ void Vore()
                }\r
                else if(time > self.complain_vore)\r
                {\r
-                       play2(self, "misc/unavailable.wav");\r
+                       play2(self, "misc/forbidden.wav");\r
                        sprint(self, "There is nothing to digest\n");\r
                        self.complain_vore = time + complain_delay_time;\r
                }\r
@@ -514,7 +775,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
@@ -527,7 +788,7 @@ void Vore()
                }\r
                else if(time > self.complain_vore)\r
                {\r
-                       play2(self, "misc/unavailable.wav");\r
+                       play2(self, "misc/forbidden.wav");\r
                        sprint(self, "There is nothing to regurgitate\n");\r
                        self.complain_vore = time + complain_delay_time;\r
                }\r
@@ -540,21 +801,23 @@ void Vore()
 // Code that addresses the prey:\r
 // --------------------------------\r
 \r
+       Vore_SetPreyPositions();\r
+\r
        // keepdeadprey - detach dead prey if their predator died or got swallowed\r
-       if(self.fakepredator.classname == "player")\r
-       if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.predator.classname == "player")\r
+       if(self.fakeprey)\r
+       if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten)\r
                Vore_DeadPrey_Detach(self);\r
 \r
-       if(self.predator.classname != "player")\r
+       if(!self.stat_eaten)\r
                return;\r
 \r
-       if(self.deadflag)\r
+       if(self.deadflag != DEAD_NO)\r
        {\r
-               Vore_PreyRelease(self);\r
+               Vore_PreyRelease(self, FALSE);\r
                return;\r
        }\r
 \r
-       if(self.predator.deadflag)\r
+       if(self.predator.deadflag != DEAD_NO)\r
                Vore_Regurgitate(self);\r
        else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
                Vore_Regurgitate(self);\r
@@ -580,5 +843,7 @@ void Vore()
        if(self.BUTTON_JUMP)\r
                Vore_StomachLeave();\r
 \r
-       Vore_CameraEffect_Apply();\r
+       // Ugly workaround for a Keyhunt issue. Your team's key can still be given to you while in the stomach\r
+       // (at round start), which is pretty ugly and wrong. So attempt to drop keys each frame for prey\r
+       kh_Key_DropAll(self, FALSE);\r
 }
\ No newline at end of file