X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=2a5e7387c1097162b40b6c8d9ac235906bcbf8b4;hp=d540bedac5842238d3c93bbfae010a4f31a8741d;hb=ce3b3f8cd34fe3be1d28ad1ee93ca03bb1e8aad7;hpb=2bf749f4895306259c9090c5219027264da91220 diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index d540beda..2a5e7387 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -1,4 +1,3 @@ -.float regurgitate_prepare; .float stomachkick_delay, system_delay, action_delay, digest_button_delay_time, regurgitate_button_delay_time; .float complain_vore; .float vore_oldmovetype, vore_oldsolid; @@ -6,7 +5,6 @@ const float system_delay_time = 0.1; const float complain_delay_time = 1; const float button_delay_time = 0.5; -const float steptime = 0.1; entity Swallow_player_check() { @@ -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 if(!self.BUTTON_REGURGITATE && time > self.action_delay) { + float prey_mass; + prey_mass = cvar("g_balance_vore_load_prey_mass"); + if(cvar("g_healthsize")) + prey_mass *= prey.scale; + string swallow_complain; if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) swallow_complain = "You cannot swallow your team mates\n"; else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time) swallow_complain = "You cannot swallow someone protected by the spawn shield\n"; - else if(self.stomach_load >= self.stomach_maxload) - swallow_complain = "You do not have any more room to swallow this player.\n"; + else if(self.stomach_load + prey_mass > self.stomach_maxload) + 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"); else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load) swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n"; else if(cvar("g_vore_biggersize") && prey.scale > self.scale) @@ -84,6 +87,18 @@ float Stomach_TeamMates_check(entity pred) return FALSE; } +float Stomach_HasLivePrey(entity pred) +{ + entity head; + FOR_EACH_PLAYER(head) + { + if(head.predator == pred) + if(head.deadflag == DEAD_NO) + return TRUE; + } + return FALSE; +} + float Vore_CanLeave() { if(self.stat_eaten) @@ -99,65 +114,22 @@ float Vore_CanLeave() } // position the camera properly for prey -void Vore_SetPreyPositions() +void Vore_SetPreyPositions(entity pred) { - // self is the predator and head is the prey + // pred is the predator and head is the prey local entity head; - local vector origin_apply; - local float position_counter; // In order to allow prey to see each other in the stomach, we must position each occupant differently, - // else all players overlap in the center. To do this, we run a loop on all players in the same stomach. - // For each player, the origin is updated, then a new origin is used for the next player. - // This requires that no more than 9 players may be in the stomach at a time! + // else all players overlap in the center. To do this, we use a random origin on all players in the same stomach. FOR_EACH_PLAYER(head) { - if(head.predator == self) + if(head.predator == pred) { - switch(position_counter) - { - case 0: - origin_apply = '0 0 0'; // first occupant sits in the middle - break; - case 1: - origin_apply = '1 0 0'; // second occupant sits in the front - break; - case 2: - origin_apply = '-1 0 0'; // third occupant sits in the back - break; - case 3: - origin_apply = '0 1 0'; // fourth occupant sits in the right - break; - case 4: - origin_apply = '0 -1 0'; // fifth occupant sits in the left - break; - case 5: - origin_apply = '1 1 0'; // sixth occupant sits in the front-right - break; - case 6: - origin_apply = '-1 1 0'; // seventh occupant sits in the back-right - break; - case 7: - origin_apply = '1 -1 0'; // eigth occupant sits in the front-left - break; - case 8: - origin_apply = '-1 -1 0'; // ninth occupant sits in the back-left - break; - default: - break; - } - // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset - head.view_ofs = PL_PREY_VIEW_OFS + origin_apply * cvar("g_vore_neighborprey_distance"); - head.view_ofs_z *= self.scale; // stomach center depends on predator scale - - // change prey height based on scale - float prey_height; - prey_height = (head.scale - self.scale) * cvar("g_healthsize_vore_pos"); - head.view_ofs_z += prey_height; - - position_counter += 1; + head.view_ofs_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance"); + head.view_ofs_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance"); + head.view_ofs_z = PL_PREY_VIEW_OFS_z; } } } @@ -165,7 +137,7 @@ void Vore_SetPreyPositions() .float gurgle_oldstomachload; void Vore_GurgleSound() { - if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load) + if(time > self.gurglesound_finished || (self.gurgle_oldstomachload != self.stomach_load && !self.digesting)) { GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE); @@ -174,31 +146,60 @@ void Vore_GurgleSound() } } +void Vore_AutoDigest(entity e) +{ + // if the predator has the autodigest preference enabled, begin digesting new prey automatically + + if(!cvar("g_vore_digestion") || e.digesting) + return; + if(clienttype(e) != CLIENTTYPE_REAL) + return; // this feature is only for players, not bots + if(e.stomach_load) + 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 + if(Stomach_TeamMates_check(e)) + return; // never begin automatic digestion if we've swallowed a team mate + + e.digesting = TRUE; +} + void Vore_StomachLoad_Apply() { // apply stomach weight that makes you heavier and larger the more you eat // slowing the player is done in cl_physics.qc + if(self.classname != "player") + return; entity e; - float vore_mass; + float prey_mass, final_load; // apply the stomach capacity of the predator self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity"); if(cvar("g_healthsize")) self.stomach_maxload *= self.scale; - self.stomach_maxload = floor(self.stomach_maxload); + self.stomach_maxload = ceil(self.stomach_maxload); - self.stomach_load = 0; // start from zero FOR_EACH_PLAYER(e) { - if(e.predator == self && e.classname == "player") + if(e.predator == self) { - vore_mass = cvar("g_balance_vore_load_prey_mass"); + prey_mass = cvar("g_balance_vore_load_prey_mass"); if(cvar("g_healthsize")) - vore_mass *= e.scale; - self.stomach_load += floor(vore_mass); + prey_mass *= e.scale; + final_load += ceil(prey_mass); + if(self.cvar_cl_vore_autodigest > 1) + Vore_AutoDigest(self); + } + } + for(e = world; (e = find(e, classname, "consumable")); ) + { + if(e.predator == self) + { + final_load += ceil(e.dmg); + if(self.cvar_cl_vore_autodigest > 0) + Vore_AutoDigest(self); } } + self.stomach_load = final_load; // apply weight self.gravity = 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_weight"); @@ -206,22 +207,6 @@ void Vore_StomachLoad_Apply() self.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity } -void Vore_AutoDigest(entity e) -{ - // if the predator has the autodigest preference enabled, begin digesting new prey automatically - - if(!cvar("g_vore_digestion") || e.digesting) - return; - if(!e.cvar_cl_vore_autodigest || clienttype(e) != CLIENTTYPE_REAL) - return; // this feature is only for players, not bots - if(e.stomach_load > 1) - 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 - if(Stomach_TeamMates_check(e)) - return; // never begin automatic digestion if we've swallowed a team mate - - e.digesting = TRUE; -} - .entity swallow_model; float Vore_SwallowModel_CustomizeEntityForClient() { @@ -302,6 +287,7 @@ void Vore_Swallow(entity e) e.vore_oldmovetype = e.movetype; e.vore_oldsolid = e.solid; + e.punchvector_z = cvar("g_balance_vore_swallow_prey_punchvector"); e.predator = self; setorigin(e, e.predator.origin); @@ -315,8 +301,8 @@ void Vore_Swallow(entity e) if(e.flagcarried) DropFlag(e.flagcarried, world, e.predator); - if(stov(cvar_string("g_vore_regurgitatecolor_release"))) - e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release")); + if(stov(cvar_string("g_vore_regurgitatecolor_color_normal"))) + e.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_normal")); if(teams_matter && e.team == e.predator.team) { @@ -328,11 +314,11 @@ void Vore_Swallow(entity e) PlayerSound(e.predator, playersound_swallow, CHAN_VOICE, VOICETYPE_PLAYERSOUND); setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating - e.predator.punchangle_x -= cvar("g_balance_vore_swallow_punchangle"); + e.predator.punchangle_x -= cvar("g_balance_vore_swallow_predator_punchangle"); e.predator.regurgitate_prepare = 0; e.predator.spawnshieldtime = 0; // lose spawn shield when we vore e.predator.hitsound += 1; // play this for team mates too, as we could be swallowing them to heal them - Vore_AutoDigest(e.predator); + Vore_SetPreyPositions(e.predator); // block firing for a small amount of time, or we'll be firing the next frame after we swallow e.predator.weapon_delay = time + button_delay_time; @@ -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 fill *= pow(self.scale / e.scale, cvar("g_balance_vore_swallow_speed_fill_scalediff")); if(cvar("g_balance_vore_swallow_speed_fill_stomachload") && e.stomach_load) // fill rate is influenced by the prey's stomach load - fill /= e.stomach_load; + fill *= (1 - ((e.stomach_load / e.stomach_maxload) * bound(0, cvar("g_balance_vore_swallow_speed_fill_stomachload"), 1))); e.swallow_progress_prey += fill; } @@ -381,22 +367,27 @@ void Vore_Regurgitate(entity e) if(e.health > 0) // leave SOLID_NOT for dead bodies e.solid = e.vore_oldsolid; e.view_ofs_z = PL_VIEW_OFS_z; + e.punchvector_z = -cvar("g_balance_vore_regurgitate_prey_punchvector"); + + // if the prey has been fully digested, silently detach them + if(e.deadflag != DEAD_NO && e.health <= cvar("g_balance_vore_digestion_limit")) + { + e.predator = world; + e.modelindex = 0; // hide the dead body + return; + } // apply velocities - local vector oldforward, oldright, oldup; - oldforward = v_forward; - oldright = v_right; - oldup = v_up; makevectors(e.predator.v_angle); e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force"); e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce"); - v_forward = oldforward; - v_right = oldright; - v_up = oldup; - e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits e.pushltime = time + cvar("g_maxpushtime"); + // if the dead body of the prey is below gibbing health, gib it + e.stat_eaten = 0; // necessary for gibs to show + PlayerGib(e, e.predator); + // regurgitated prey is given this amount of swallow progress, to simulate being more vulnerable if(cvar("g_balance_vore_swallow_speed_fill") && cvar("g_balance_vore_regurgitate_swallowprogress")) { @@ -411,15 +402,16 @@ void Vore_Regurgitate(entity e) regurgitate_dmg = cvar("g_balance_vore_regurgitate_damage"); if(cvar("g_healthsize")) regurgitate_dmg *= e.scale / e.predator.scale; - Damage(e.predator, e.predator, e.predator, regurgitate_dmg, DEATH_REGURGITATION, e.predator.origin, '0 0 0'); + Damage(e.predator, e, e, regurgitate_dmg, DEATH_REGURGITATION, e.predator.origin, '0 0 0'); } PlayerSound(e.predator, playersound_regurgitate, CHAN_VOICE, VOICETYPE_PLAYERSOUND); setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', 1); - e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle"); + e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_predator_punchangle"); e.predator.regurgitate_prepare = 0; e.predator.action_delay = time + cvar("g_balance_vore_action_delay"); + Vore_SetPreyPositions(e.predator); // block firing for a small amount of time, or we'll be firing the next frame e.weapon_delay = time + button_delay_time; @@ -427,80 +419,24 @@ void Vore_Regurgitate(entity e) e.predator = world; } -void Vore_DeadPrey_Configure(entity e) -{ - // ran when the keepdeadprey feature is enabled and prey stays inside the stomach after dying - - if(e.fakeprey || !e.stat_eaten) // we already configured everything - return; - - // this entity is like e.predator but for dead prey, to avoid conflicts - e.fakepredator = e.predator; - e.fakeprey = TRUE; - - // first release the prey from the predator, as dead prey needs to be attached differently - // the predator's stomach load is also decreased, as dead prey doesn't count any more - e.predator = world; - - // now put our dead prey inside the predator's stomach, but only as an effect - e.movetype = MOVETYPE_FOLLOW; - e.takedamage = DAMAGE_NO; - e.solid = SOLID_NOT; - e.aiment = e.fakepredator; -} - -void Vore_DeadPrey_Detach(entity e) -{ - // ran when dead prey must be detached from the stomach (eg: they are respawning) - // should only execute after Vore_DeadPrey_Configure has ran first - - if not(cvar("g_vore_keepdeadprey")) - return; - - e.fakepredator = world; - e.fakeprey = TRUE; // keep fakeprey status - e.stat_eaten = 0; - e.aiment = world; - e.movetype = MOVETYPE_TOSS; -} - -void Vore_PreyRelease(entity e, float pred_disconnect) -{ - if(pred_disconnect) - { - if(e.fakeprey) - Vore_DeadPrey_Detach(e); - else - Vore_Regurgitate(e); - } - else if(self.stat_eaten && !self.fakeprey) - { - // if the keepdeadprey feature is on, don't spit a dead prey's carcass out - if(e.deadflag != DEAD_NO && random() < cvar("g_vore_keepdeadprey")) - Vore_DeadPrey_Configure(e); - else - Vore_Regurgitate(e); - } -} - void Vore_Disconnect() { // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances // prey disconnects or goes spectating while inside someone's belly if(self.stat_eaten) - Vore_PreyRelease(self, TRUE); + Vore_Regurgitate(self); // pred disconnects or goes spectating with players in their belly entity head; FOR_EACH_PLAYER(head) { - if(head.predator == self || head.fakepredator == self) - Vore_PreyRelease(head, TRUE); + if(head.predator == self) + Vore_Regurgitate(head); } - Vore_GurgleSound(); // stop the gurgling sound self.stomach_load = self.gravity = 0; // prevents a bug + Vore_GurgleSound(); // stop the gurgling sound } .float digestion_step; @@ -508,37 +444,41 @@ void Vore_Digest() { // apply digestion to prey + if(self.predator.deadflag != DEAD_NO) // dead predators don't digest + { + self.predator.digesting = FALSE; + return; + } + if(self.health <= cvar("g_balance_vore_digestion_limit")) // don't digest below this amount of health + return; + if(time > self.digestion_step) { // if distributed digestion is enabled, reduce digestion strength by the amount of prey in our stomach - float vore_offset; - if(cvar("g_balance_vore_digestion_distribute")) - vore_offset = self.predator.stomach_maxload / self.predator.stomach_load; - else - vore_offset = 1; + float damage, damage_offset; - float damage; - damage = cvar("g_balance_vore_digestion_damage") / vore_offset; + damage_offset = 1; + if(cvar("g_balance_vore_digestion_distribute")) // apply distributed digestion damage + damage_offset /= self.predator.stomach_load / self.predator.stomach_maxload; + if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff")) // apply player scale to digestion damage + damage_offset *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_digestion_scalediff")); - // apply player scale to digestion damage - if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff")) - damage *= pow(self.predator.scale / self.scale, cvar("g_balance_vore_digestion_scalediff")); + damage = ceil(cvar("g_balance_vore_digestion_damage") / damage_offset); + if(cvar("g_balance_vore_digestion_damage_death") && self.deadflag != DEAD_NO) // amplify digestion damage for dead prey + damage *= cvar("g_balance_vore_digestion_damage_death"); Damage(self, self.predator, self.predator, damage, DEATH_DIGESTION, self.origin, '0 0 0'); if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable")) - self.predator.health += cvar("g_balance_vore_digestion_vampire") / vore_offset; - - if (self.predator.digestsound_finished < time) { - PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); - self.predator.digestsound_finished = time + 0.5; + self.predator.health += damage * cvar("g_balance_vore_digestion_vampire"); + self.predator.pauserothealth_finished = max(self.predator.pauserothealth_finished, time + cvar("g_balance_pause_health_rot")); } - self.digestion_step = time + steptime; + + self.digestion_step = time + vore_steptime; } - if(self.deadflag != DEAD_NO) - if(stov(cvar_string("g_vore_regurgitatecolor_digest"))) - self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digest")); + if(stov(cvar_string("g_vore_regurgitatecolor_color_digest"))) + self.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_digest")); } .float teamheal_step; @@ -546,11 +486,14 @@ void Vore_Teamheal() { // apply teamheal + if(self.deadflag != DEAD_NO) + return; + if(cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable")) if(time > self.teamheal_step) { self.health += cvar("g_balance_vore_teamheal"); - self.teamheal_step = time + steptime; + self.teamheal_step = time + vore_steptime; // play beep sound when a team mate was healed to the maximum amount, to both the prey and the predator if(self.health >= cvar("g_balance_vore_teamheal_stable")) @@ -566,6 +509,9 @@ void Vore_StomachKick() { // allows prey to kick the predator's stomach and do some damage or attempt to escape + if(self.deadflag != DEAD_NO) + return; + if(time > self.stomachkick_delay && !self.kick_pressed) { float damage, vol; @@ -603,6 +549,9 @@ void Vore_StomachLeave() { // allows players to get out of their predator at will in some circumstances, such as team mates + if(self.deadflag != DEAD_NO) + return; + if(Vore_CanLeave()) Vore_Regurgitate(self); else if(time > self.complain_vore) @@ -620,7 +569,7 @@ void Vore_AutoTaunt() float taunt_time; // predator taunts - if(self.stomach_load && !Stomach_TeamMates_check(self)) + if((self.swallow_progress_pred || (self.stomach_load && Stomach_HasLivePrey(self))) && !Stomach_TeamMates_check(self)) { if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played { @@ -635,7 +584,7 @@ void Vore_AutoTaunt() } // prey taunts - if(self.stat_eaten && !(teams_matter && self.team == self.predator.team)) + if((self.swallow_progress_prey || (self.stat_eaten && !(teams_matter && self.team == self.predator.team))) && self.deadflag == DEAD_NO) { if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played { @@ -690,34 +639,49 @@ void Vore_SetSbarRings() } } +.float regurgitatecolor_particles_tick; void Vore() { // main vore code, this is where it all happens Vore_AutoTaunt(); - // wash the goo away from players once they leave the stomach if(!self.stat_eaten) - if(stov(cvar_string("g_vore_regurgitatecolor_release"))) + if(self.modelindex) // not if we're a gibbed dead body or not visible any more if(self.colormod) - if(cvar("g_vore_regurgitatecolor_release_fade")) + if(self.colormod != '1 1 1') { - self.colormod_x += cvar("g_vore_regurgitatecolor_release_fade") * frametime; - if(self.colormod_x > 1) - self.colormod_x = 1; - self.colormod_y += cvar("g_vore_regurgitatecolor_release_fade") * frametime; - if(self.colormod_y > 1) - self.colormod_y = 1; - self.colormod_z += cvar("g_vore_regurgitatecolor_release_fade") * frametime; - if(self.colormod_z > 1) - self.colormod_z = 1; + // slowly wash stomach fluids off players once they're out of the stomach + if(cvar("g_vore_regurgitatecolor_fade")) + if(self.deadflag == DEAD_NO) // not for dead bodies + { + float goo_fade; + goo_fade = cvar("g_vore_regurgitatecolor_fade") * frametime; + goo_fade *= 1 + self.waterlevel; // fade faster when underwater + + self.colormod_x += goo_fade; + if(self.colormod_x > 1) + self.colormod_x = 1; + self.colormod_y += goo_fade; + if(self.colormod_y > 1) + self.colormod_y = 1; + self.colormod_z += goo_fade; + if(self.colormod_z > 1) + self.colormod_z = 1; + } + + // constant particles falling off dirty players + if(cvar("g_vore_regurgitatecolor_particles")) + if(self.regurgitatecolor_particles_tick < time) + { + pointparticles(particleeffectnum("vore_regurgitate_constant"), self.origin, '0 0 0', 1); + self.regurgitatecolor_particles_tick = time + cvar("g_vore_regurgitatecolor_particles") * vlen(self.colormod); // particle time depends on how dirty the player is + } } // set all vore stats Vore_SetSbarRings(); - if(self.fakepredator.classname == "player") - self.stat_eaten = num_for_edict(self.fakepredator); - else if(self.predator.classname == "player") + if(self.predator.classname == "player") { self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board self.stat_stomachmaxload = self.predator.stomach_maxload; // necessary for the stomach board @@ -737,26 +701,8 @@ void Vore() // prevent this by checking if such has happened, and taking the proper measures // this code has a high priority and must not be stopped by any delay, so run it here if(self.predator.stat_eaten) - { - entity target_predator, target_predator_predator, oldself; - target_predator = self.predator; - target_predator_predator = self.predator.predator; - Vore_Regurgitate(self); - // now steal our prey's prey if this probability applies - if(random() < cvar("g_balance_vore_swallow_stealprey")) - { - oldself = self; - self = target_predator_predator; - if(Swallow_condition_check(oldself)) - if not(teams_matter && self.team == target_predator.team) // don't steal a team mate's prey - if not(teams_matter && self.team == oldself.team) // if the prey we would be stealing is a team mate, don't do it - Vore_Swallow(oldself); - self = oldself; - } - } - // the swallow progress of prey and preds idly decrease by this amount if(cvar("g_balance_vore_swallow_speed_decrease")) { @@ -774,6 +720,9 @@ void Vore() } } + // set the predator's stomach load and capacity + Vore_StomachLoad_Apply(); + // apply delays and skip the vore system under some circumstances if(!cvar("g_vore")) // the vore system is disabled { @@ -797,9 +746,6 @@ void Vore() entity prey; prey = Swallow_player_check(); - // set the predator's stomach load and capacity - Vore_StomachLoad_Apply(); - // attempt to swallow our new prey if we pressed the attack button, and there's any in range self.stat_canswallow = 0; if(Swallow_condition_check(prey)) @@ -858,6 +804,23 @@ void Vore() } } + if(self.stomach_load > self.stomach_maxload) // the predator got beyond his capacity after eating, so some prey must pop out + { + self.regurgitate_prepare = -1; + return; + } + if(cvar("g_balance_vore_load_pred_speedcap") && self.stomach_load) + 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 + { + self.regurgitate_prepare = -1; + return; + } + + if (self.digesting && self.digestsound_finished < time) + { + PlayerSound (self, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + self.digestsound_finished = time + 0.5; + } if(cvar("g_vore_gurglesound")) Vore_GurgleSound(); @@ -865,26 +828,31 @@ void Vore() // Code that addresses the prey: // -------------------------------- - Vore_SetPreyPositions(); - - // keepdeadprey - detach dead prey if their predator died or got swallowed - if(self.fakeprey) - if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten) - Vore_DeadPrey_Detach(self); - if(!self.stat_eaten) return; - if(self.deadflag != DEAD_NO) + if(self.deadflag != DEAD_NO && self.health < cvar("g_balance_vore_digestion_limit")) // make sure health doesn't go below the limit + self.health = cvar("g_balance_vore_digestion_limit"); + + // automatically regurgitate prey that has reached their digestion limit + if(cvar("g_balance_vore_digestion_limit_regurgitate")) + if(self.health <= cvar("g_balance_vore_digestion_limit")) { - Vore_PreyRelease(self, FALSE); + Vore_Regurgitate(self); return; } + // do we stick around inside dead furries? x_x if(self.predator.deadflag != DEAD_NO) - Vore_Regurgitate(self); - 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)) - Vore_Regurgitate(self); + { + if(!cvar("g_balance_vore_deadpredator") || !self.predator.modelindex) // if the predator is gibbed, we are out + { + Vore_Regurgitate(self); + return; + } + if(self.predator.regurgitate_prepare) // abort scheduled regurgitation + self.predator.regurgitate_prepare = 0; + } // apply delayed regurgitating if it was scheduled if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare) @@ -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 // (at round start), which is pretty ugly and wrong. So attempt to drop keys each frame for prey kh_Key_DropAll(self, FALSE); + + // always position camera at the center of the stomach, to reduce probability of the view poking out + self.view_ofs_z = PL_PREY_VIEW_OFS_z * self.predator.scale; } \ No newline at end of file