]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Reorder some code
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index d540bedac5842238d3c93bbfae010a4f31a8741d..2a5e7387c1097162b40b6c8d9ac235906bcbf8b4 100644 (file)
@@ -1,4 +1,3 @@
-.float regurgitate_prepare;\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;\r
@@ -6,7 +5,6 @@
 const float system_delay_time = 0.1;\r
 const float complain_delay_time = 1;\r
 const float button_delay_time = 0.5;\r
-const float steptime = 0.1;\r
 \r
 entity Swallow_player_check()\r
 {\r
@@ -41,13 +39,18 @@ float Swallow_condition_check(entity prey)
        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
        {\r
+               float prey_mass;\r
+               prey_mass = cvar("g_balance_vore_load_prey_mass");\r
+               if(cvar("g_healthsize"))\r
+                       prey_mass *= prey.scale;\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 >= self.stomach_maxload)\r
-                       swallow_complain = "You do not have any more room to swallow this player.\n";\r
+               else if(self.stomach_load + prey_mass > self.stomach_maxload)\r
+                       swallow_complain = strcat("You don't have any room to swallow this player. Their mass is ^3", ftos(prey_mass), "^7 and your remaining capacity is ^3", ftos(self.stomach_maxload - self.stomach_load), "\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
@@ -84,6 +87,18 @@ float Stomach_TeamMates_check(entity pred)
        return FALSE;\r
 }\r
 \r
+float Stomach_HasLivePrey(entity pred)\r
+{\r
+       entity head;\r
+       FOR_EACH_PLAYER(head)\r
+       {\r
+               if(head.predator == pred)\r
+               if(head.deadflag == DEAD_NO)\r
+                       return TRUE;\r
+       }\r
+       return FALSE;\r
+}\r
+\r
 float Vore_CanLeave()\r
 {\r
        if(self.stat_eaten)\r
@@ -99,65 +114,22 @@ float Vore_CanLeave()
 }\r
 \r
 // position the camera properly for prey\r
-void Vore_SetPreyPositions()\r
+void Vore_SetPreyPositions(entity pred)\r
 {\r
-       // self is the predator and head is the prey\r
+       // pred is the predator and head is the prey\r
 \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
+       // else all players overlap in the center. To do this, we use a random origin on all players in the same stomach.\r
        FOR_EACH_PLAYER(head)\r
        {\r
-               if(head.predator == self)\r
+               if(head.predator == pred)\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
                        // 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
-                       position_counter += 1;\r
+                       head.view_ofs_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_z = PL_PREY_VIEW_OFS_z;\r
                }\r
        }\r
 }\r
@@ -165,7 +137,7 @@ void Vore_SetPreyPositions()
 .float gurgle_oldstomachload;\r
 void Vore_GurgleSound()\r
 {\r
-       if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load)\r
+       if(time > self.gurglesound_finished || (self.gurgle_oldstomachload != self.stomach_load && !self.digesting))\r
        {\r
                GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE);\r
 \r
@@ -174,31 +146,60 @@ void Vore_GurgleSound()
        }\r
 }\r
 \r
+void Vore_AutoDigest(entity e)\r
+{\r
+       // if the predator has the autodigest preference enabled, begin digesting new prey automatically\r
+\r
+       if(!cvar("g_vore_digestion") || e.digesting)\r
+               return;\r
+       if(clienttype(e) != CLIENTTYPE_REAL)\r
+               return; // this feature is only for players, not bots\r
+       if(e.stomach_load)\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_StomachLoad_Apply()\r
 {\r
        // apply stomach weight that makes you heavier and larger the more you eat\r
        // slowing the player is done in cl_physics.qc\r
+       if(self.classname != "player")\r
+               return;\r
 \r
        entity e;\r
-       float vore_mass;\r
+       float prey_mass, final_load;\r
 \r
        // apply the stomach capacity of the predator\r
        self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity");\r
        if(cvar("g_healthsize"))\r
                self.stomach_maxload *= self.scale;\r
-       self.stomach_maxload = floor(self.stomach_maxload);\r
+       self.stomach_maxload = ceil(self.stomach_maxload);\r
 \r
-       self.stomach_load = 0; // start from zero\r
        FOR_EACH_PLAYER(e)\r
        {\r
-               if(e.predator == self && e.classname == "player")\r
+               if(e.predator == self)\r
                {\r
-                       vore_mass = cvar("g_balance_vore_load_prey_mass");\r
+                       prey_mass = cvar("g_balance_vore_load_prey_mass");\r
                        if(cvar("g_healthsize"))\r
-                               vore_mass *= e.scale;\r
-                       self.stomach_load += floor(vore_mass);\r
+                               prey_mass *= e.scale;\r
+                       final_load += ceil(prey_mass);\r
+                       if(self.cvar_cl_vore_autodigest > 1)\r
+                               Vore_AutoDigest(self);\r
+               }\r
+       }\r
+       for(e = world; (e = find(e, classname, "consumable")); )\r
+       {\r
+               if(e.predator == self)\r
+               {\r
+                       final_load += ceil(e.dmg);\r
+                       if(self.cvar_cl_vore_autodigest > 0)\r
+                               Vore_AutoDigest(self);\r
                }\r
        }\r
+       self.stomach_load = final_load;\r
 \r
        // apply weight\r
        self.gravity = 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_weight");\r
@@ -206,22 +207,6 @@ void Vore_StomachLoad_Apply()
                self.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity\r
 }\r
 \r
-void Vore_AutoDigest(entity e)\r
-{\r
-       // if the predator has the autodigest preference enabled, begin digesting new prey automatically\r
-\r
-       if(!cvar("g_vore_digestion") || e.digesting)\r
-               return;\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
 .entity swallow_model;\r
 float Vore_SwallowModel_CustomizeEntityForClient()\r
 {\r
@@ -302,6 +287,7 @@ void Vore_Swallow(entity e)
 \r
        e.vore_oldmovetype = e.movetype;\r
        e.vore_oldsolid = e.solid;\r
+       e.punchvector_z = cvar("g_balance_vore_swallow_prey_punchvector");\r
 \r
        e.predator = self;\r
        setorigin(e, e.predator.origin);\r
@@ -315,8 +301,8 @@ void Vore_Swallow(entity e)
        if(e.flagcarried)\r
                DropFlag(e.flagcarried, world, e.predator);\r
 \r
-       if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
-               e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release"));\r
+       if(stov(cvar_string("g_vore_regurgitatecolor_color_normal")))\r
+               e.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_normal"));\r
 \r
        if(teams_matter && e.team == e.predator.team)\r
        {\r
@@ -328,11 +314,11 @@ void Vore_Swallow(entity e)
 \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 -= cvar("g_balance_vore_swallow_punchangle");\r
+       e.predator.punchangle_x -= cvar("g_balance_vore_swallow_predator_punchangle");\r
        e.predator.regurgitate_prepare = 0;\r
        e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
        e.predator.hitsound += 1; // play this for team mates too, as we could be swallowing them to heal them\r
-       Vore_AutoDigest(e.predator);\r
+       Vore_SetPreyPositions(e.predator);\r
 \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
@@ -359,7 +345,7 @@ void Vore_SwallowStep(entity e)
                if(cvar("g_healthsize") && cvar("g_balance_vore_swallow_speed_fill_scalediff")) // fill rate depends on predator size compared to prey size\r
                        fill *= pow(self.scale / e.scale, cvar("g_balance_vore_swallow_speed_fill_scalediff"));\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
+                       fill *= (1 - ((e.stomach_load / e.stomach_maxload) * bound(0, cvar("g_balance_vore_swallow_speed_fill_stomachload"), 1)));\r
 \r
                e.swallow_progress_prey += fill;\r
        }\r
@@ -381,22 +367,27 @@ 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.punchvector_z = -cvar("g_balance_vore_regurgitate_prey_punchvector");\r
+\r
+       // if the prey has been fully digested, silently detach them\r
+       if(e.deadflag != DEAD_NO && e.health <= cvar("g_balance_vore_digestion_limit"))\r
+       {\r
+               e.predator = world;\r
+               e.modelindex = 0; // hide the dead body\r
+               return;\r
+       }\r
 \r
        // apply velocities\r
-       local vector oldforward, oldright, oldup;\r
-       oldforward = v_forward;\r
-       oldright = v_right;\r
-       oldup = v_up;\r
        makevectors(e.predator.v_angle);\r
        e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");\r
        e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce");\r
-       v_forward = oldforward;\r
-       v_right = oldright;\r
-       v_up = oldup;\r
-\r
        e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits\r
        e.pushltime = time + cvar("g_maxpushtime");\r
 \r
+       // if the dead body of the prey is below gibbing health, gib it\r
+       e.stat_eaten = 0; // necessary for gibs to show\r
+       PlayerGib(e, e.predator);\r
+\r
        // regurgitated prey is given this amount of swallow progress, to simulate being more vulnerable\r
        if(cvar("g_balance_vore_swallow_speed_fill") && cvar("g_balance_vore_regurgitate_swallowprogress"))\r
        {\r
@@ -411,15 +402,16 @@ void Vore_Regurgitate(entity e)
                regurgitate_dmg = cvar("g_balance_vore_regurgitate_damage");\r
                if(cvar("g_healthsize"))\r
                        regurgitate_dmg *= e.scale / e.predator.scale;\r
-               Damage(e.predator, e.predator, e.predator, regurgitate_dmg, DEATH_REGURGITATION, e.predator.origin, '0 0 0');\r
+               Damage(e.predator, e, e, regurgitate_dmg, DEATH_REGURGITATION, e.predator.origin, '0 0 0');\r
        }\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("vore_regurgitate"), e.predator.origin, '0 0 0', 1);\r
-       e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle");\r
+       e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_predator_punchangle");\r
        e.predator.regurgitate_prepare = 0;\r
        e.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
+       Vore_SetPreyPositions(e.predator);\r
 \r
        // block firing for a small amount of time, or we'll be firing the next frame\r
        e.weapon_delay = time + button_delay_time;\r
@@ -427,80 +419,24 @@ void Vore_Regurgitate(entity e)
        e.predator = world;\r
 }\r
 \r
-void Vore_DeadPrey_Configure(entity e)\r
-{\r
-       // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying\r
-\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
-       e.fakepredator = e.predator;\r
-       e.fakeprey = TRUE;\r
-\r
-       // first release the prey from the predator, as dead prey needs to be attached differently\r
-       // the predator's stomach load is also decreased, as dead prey doesn't count any more\r
-       e.predator = world;\r
-\r
-       // now put our dead prey inside the predator's stomach, but only as an effect\r
-       e.movetype = MOVETYPE_FOLLOW;\r
-       e.takedamage = DAMAGE_NO;\r
-       e.solid = SOLID_NOT;\r
-       e.aiment = e.fakepredator;\r
-}\r
-\r
-void Vore_DeadPrey_Detach(entity e)\r
-{\r
-       // ran when dead prey must be detached from the stomach (eg: they are respawning)\r
-       // should only execute after Vore_DeadPrey_Configure has ran first\r
-\r
-       if not(cvar("g_vore_keepdeadprey"))\r
-               return;\r
-\r
-       e.fakepredator = world;\r
-       e.fakeprey = TRUE; // keep fakeprey status\r
-       e.stat_eaten = 0;\r
-       e.aiment = world;\r
-       e.movetype = MOVETYPE_TOSS;\r
-}\r
-\r
-void Vore_PreyRelease(entity e, float pred_disconnect)\r
-{\r
-       if(pred_disconnect)\r
-       {\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
-}\r
-\r
 void Vore_Disconnect()\r
 {\r
        // 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.stat_eaten)\r
-               Vore_PreyRelease(self, TRUE);\r
+               Vore_Regurgitate(self);\r
 \r
        // pred disconnects or goes spectating with players in their belly\r
        entity head;\r
        FOR_EACH_PLAYER(head)\r
        {\r
-               if(head.predator == self || head.fakepredator == self)\r
-                       Vore_PreyRelease(head, TRUE);\r
+               if(head.predator == self)\r
+                       Vore_Regurgitate(head);\r
        }\r
-       Vore_GurgleSound(); // stop the gurgling sound\r
 \r
        self.stomach_load = self.gravity = 0; // prevents a bug\r
+       Vore_GurgleSound(); // stop the gurgling sound\r
 }\r
 \r
 .float digestion_step;\r
@@ -508,37 +444,41 @@ void Vore_Digest()
 {\r
        // apply digestion to prey\r
 \r
+       if(self.predator.deadflag != DEAD_NO) // dead predators don't digest\r
+       {\r
+               self.predator.digesting = FALSE;\r
+               return;\r
+       }\r
+       if(self.health <= cvar("g_balance_vore_digestion_limit")) // don't digest below this amount of health\r
+               return;\r
+\r
        if(time > self.digestion_step)\r
        {\r
                // if distributed digestion is enabled, reduce digestion strength by the amount of prey in our stomach\r
-               float vore_offset;\r
-               if(cvar("g_balance_vore_digestion_distribute"))\r
-                       vore_offset = self.predator.stomach_maxload / self.predator.stomach_load;\r
-               else\r
-                       vore_offset = 1;\r
+               float damage, damage_offset;\r
 \r
-               float damage;\r
-               damage = cvar("g_balance_vore_digestion_damage") / vore_offset;\r
+               damage_offset = 1;\r
+               if(cvar("g_balance_vore_digestion_distribute")) // apply distributed digestion damage\r
+                       damage_offset /= self.predator.stomach_load / self.predator.stomach_maxload;\r
+               if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff")) // apply player scale to digestion damage\r
+                       damage_offset *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_digestion_scalediff"));\r
 \r
-               // apply player scale to digestion damage\r
-               if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff"))\r
-                       damage *= pow(self.predator.scale / self.scale, cvar("g_balance_vore_digestion_scalediff"));\r
+               damage = ceil(cvar("g_balance_vore_digestion_damage") / damage_offset);\r
+               if(cvar("g_balance_vore_digestion_damage_death") && self.deadflag != DEAD_NO) // amplify digestion damage for dead prey\r
+                       damage *= cvar("g_balance_vore_digestion_damage_death");\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") / vore_offset;\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
+                       self.predator.health += damage * cvar("g_balance_vore_digestion_vampire");\r
+                       self.predator.pauserothealth_finished = max(self.predator.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));\r
                }\r
-               self.digestion_step = time + steptime;\r
+\r
+               self.digestion_step = time + vore_steptime;\r
        }\r
 \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
+       if(stov(cvar_string("g_vore_regurgitatecolor_color_digest")))\r
+               self.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_digest"));\r
 }\r
 \r
 .float teamheal_step;\r
@@ -546,11 +486,14 @@ void Vore_Teamheal()
 {\r
        // apply teamheal\r
 \r
+       if(self.deadflag != DEAD_NO)\r
+               return;\r
+\r
        if(cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable"))\r
        if(time > self.teamheal_step)\r
        {\r
                self.health += cvar("g_balance_vore_teamheal");\r
-               self.teamheal_step = time + steptime;\r
+               self.teamheal_step = time + vore_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
@@ -566,6 +509,9 @@ void Vore_StomachKick()
 {\r
        // allows prey to kick the predator's stomach and do some damage or attempt to escape\r
 \r
+       if(self.deadflag != DEAD_NO)\r
+               return;\r
+\r
        if(time > self.stomachkick_delay && !self.kick_pressed)\r
        {\r
                float damage, vol;\r
@@ -603,6 +549,9 @@ void Vore_StomachLeave()
 {\r
        // allows players to get out of their predator at will in some circumstances, such as team mates\r
 \r
+       if(self.deadflag != DEAD_NO)\r
+               return;\r
+\r
        if(Vore_CanLeave())\r
                Vore_Regurgitate(self);\r
        else if(time > self.complain_vore)\r
@@ -620,7 +569,7 @@ void Vore_AutoTaunt()
        float taunt_time;\r
 \r
        // predator taunts\r
-       if(self.stomach_load && !Stomach_TeamMates_check(self))\r
+       if((self.swallow_progress_pred || (self.stomach_load && Stomach_HasLivePrey(self))) && !Stomach_TeamMates_check(self))\r
        {\r
                if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
                {\r
@@ -635,7 +584,7 @@ void Vore_AutoTaunt()
        }\r
 \r
        // prey taunts\r
-       if(self.stat_eaten && !(teams_matter && self.team == self.predator.team))\r
+       if((self.swallow_progress_prey || (self.stat_eaten && !(teams_matter && self.team == self.predator.team))) && self.deadflag == DEAD_NO)\r
        {\r
                if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
                {\r
@@ -690,34 +639,49 @@ void Vore_SetSbarRings()
        }\r
 }\r
 \r
+.float regurgitatecolor_particles_tick;\r
 void Vore()\r
 {\r
        // main vore code, this is where it all happens\r
 \r
        Vore_AutoTaunt();\r
 \r
-       // wash the goo away from players once they leave the stomach\r
        if(!self.stat_eaten)\r
-       if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
+       if(self.modelindex) // not if we're a gibbed dead body or not visible any more\r
        if(self.colormod)\r
-       if(cvar("g_vore_regurgitatecolor_release_fade"))\r
+       if(self.colormod != '1 1 1')\r
        {\r
-               self.colormod_x += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
-               if(self.colormod_x > 1)\r
-                       self.colormod_x = 1;\r
-               self.colormod_y += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
-               if(self.colormod_y > 1)\r
-                       self.colormod_y = 1;\r
-               self.colormod_z += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
-               if(self.colormod_z > 1)\r
-                       self.colormod_z = 1;\r
+               // slowly wash stomach fluids off players once they're out of the stomach\r
+               if(cvar("g_vore_regurgitatecolor_fade"))\r
+               if(self.deadflag == DEAD_NO) // not for dead bodies\r
+               {\r
+                       float goo_fade;\r
+                       goo_fade = cvar("g_vore_regurgitatecolor_fade") * frametime;\r
+                       goo_fade *= 1 + self.waterlevel; // fade faster when underwater\r
+\r
+                       self.colormod_x += goo_fade;\r
+                       if(self.colormod_x > 1)\r
+                               self.colormod_x = 1;\r
+                       self.colormod_y += goo_fade;\r
+                       if(self.colormod_y > 1)\r
+                               self.colormod_y = 1;\r
+                       self.colormod_z += goo_fade;\r
+                       if(self.colormod_z > 1)\r
+                               self.colormod_z = 1;\r
+               }\r
+\r
+               // constant particles falling off dirty players\r
+               if(cvar("g_vore_regurgitatecolor_particles"))\r
+               if(self.regurgitatecolor_particles_tick < time)\r
+               {\r
+                       pointparticles(particleeffectnum("vore_regurgitate_constant"), self.origin, '0 0 0', 1);\r
+                       self.regurgitatecolor_particles_tick = time + cvar("g_vore_regurgitatecolor_particles") * vlen(self.colormod); // particle time depends on how dirty the player is\r
+               }\r
        }\r
 \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
+       if(self.predator.classname == "player")\r
        {\r
                self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board\r
                self.stat_stomachmaxload = self.predator.stomach_maxload; // necessary for the stomach board\r
@@ -737,26 +701,8 @@ void Vore()
        // 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.stat_eaten)\r
-       {\r
-               entity target_predator, target_predator_predator, oldself;\r
-               target_predator = self.predator;\r
-               target_predator_predator = self.predator.predator;\r
-\r
                Vore_Regurgitate(self);\r
 \r
-               // now steal our prey's prey if this probability applies\r
-               if(random() < cvar("g_balance_vore_swallow_stealprey"))\r
-               {\r
-                       oldself = self;\r
-                       self = target_predator_predator;\r
-                       if(Swallow_condition_check(oldself))\r
-                       if not(teams_matter && self.team == target_predator.team) // don't steal a team mate's prey\r
-                       if not(teams_matter && self.team == oldself.team) // if the prey we would be stealing is a team mate, don't do it\r
-                               Vore_Swallow(oldself);\r
-                       self = oldself;\r
-               }\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
@@ -774,6 +720,9 @@ void Vore()
                }\r
        }\r
 \r
+       // set the predator's stomach load and capacity\r
+       Vore_StomachLoad_Apply();\r
+\r
        // apply delays and skip the vore system under some circumstances\r
        if(!cvar("g_vore")) // the vore system is disabled\r
        {\r
@@ -797,9 +746,6 @@ void Vore()
        entity prey;\r
        prey = Swallow_player_check();\r
 \r
-       // set the predator's stomach load and capacity\r
-       Vore_StomachLoad_Apply();\r
-\r
        // attempt to swallow our new prey if we pressed the attack button, and there's any in range\r
        self.stat_canswallow = 0;\r
        if(Swallow_condition_check(prey))\r
@@ -858,6 +804,23 @@ void Vore()
                }\r
        }\r
 \r
+       if(self.stomach_load > self.stomach_maxload) // the predator got beyond his capacity after eating, so some prey must pop out\r
+       {\r
+               self.regurgitate_prepare = -1;\r
+               return;\r
+       }\r
+       if(cvar("g_balance_vore_load_pred_speedcap") && self.stomach_load)\r
+       if(vlen(self.velocity) >= cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_load / self.stomach_maxload)) // predator's going too fast, gets sick and throws up\r
+       {\r
+               self.regurgitate_prepare = -1;\r
+               return;\r
+       }\r
+\r
+       if (self.digesting && self.digestsound_finished < time)\r
+       {\r
+               PlayerSound (self, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
+               self.digestsound_finished = time + 0.5;\r
+       }\r
        if(cvar("g_vore_gurglesound"))\r
                Vore_GurgleSound();\r
 \r
@@ -865,26 +828,31 @@ 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.fakeprey)\r
-       if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten)\r
-               Vore_DeadPrey_Detach(self);\r
-\r
        if(!self.stat_eaten)\r
                return;\r
 \r
-       if(self.deadflag != DEAD_NO)\r
+       if(self.deadflag != DEAD_NO && self.health < cvar("g_balance_vore_digestion_limit")) // make sure health doesn't go below the limit\r
+               self.health = cvar("g_balance_vore_digestion_limit");\r
+\r
+       // automatically regurgitate prey that has reached their digestion limit\r
+       if(cvar("g_balance_vore_digestion_limit_regurgitate"))\r
+       if(self.health <= cvar("g_balance_vore_digestion_limit"))\r
        {\r
-               Vore_PreyRelease(self, FALSE);\r
+               Vore_Regurgitate(self);\r
                return;\r
        }\r
 \r
+       // do we stick around inside dead furries? x_x\r
        if(self.predator.deadflag != DEAD_NO)\r
-               Vore_Regurgitate(self);\r
-       else if(cvar("g_balance_vore_load_pred_speedcap") && vlen(self.predator.velocity) >= cvar("g_balance_vore_load_pred_speedcap") / (self.predator.stomach_load / self.predator.stomach_maxload))\r
-               Vore_Regurgitate(self);\r
+       {\r
+               if(!cvar("g_balance_vore_deadpredator") || !self.predator.modelindex) // if the predator is gibbed, we are out\r
+               {\r
+                       Vore_Regurgitate(self);\r
+                       return;\r
+               }\r
+               if(self.predator.regurgitate_prepare) // abort scheduled regurgitation\r
+                       self.predator.regurgitate_prepare = 0;\r
+       }\r
 \r
        // apply delayed regurgitating if it was scheduled\r
        if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare)\r
@@ -915,4 +883,7 @@ void Vore()
        // 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
+\r
+       // always position camera at the center of the stomach, to reduce probability of the view poking out\r
+       self.view_ofs_z = PL_PREY_VIEW_OFS_z * self.predator.scale;\r
 }
\ No newline at end of file