X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=146a763a3a19c5ac73b175b7571ca4e5fc06be5d;hb=2f8dd54fcf6f16872983062f888339307c8dd46b;hp=b53642b1461c761396c642e33e8416ae93e1a5d5;hpb=eee227a82cfad62df5b273c10b8ace2000e1c972;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index b53642b1..146a763a 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() { @@ -89,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) @@ -109,7 +119,6 @@ void Vore_SetPreyPositions(entity pred) // pred is the predator and head is the prey local entity head; - local vector origin_apply; // 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 use a random origin on all players in the same stomach. @@ -117,18 +126,10 @@ void Vore_SetPreyPositions(entity pred) { if(head.predator == pred) { - origin_apply_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance"); - origin_apply_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance"); - origin_apply_z = PL_PREY_VIEW_OFS_z; - // 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 = origin_apply; - head.view_ofs_z *= pred.scale; // stomach center depends on predator scale - - // change prey height based on scale - float prey_height; - prey_height = (head.scale - pred.scale) * cvar("g_healthsize_vore_pos"); - head.view_ofs_z += prey_height; + 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; } } } @@ -136,30 +137,54 @@ void Vore_SetPreyPositions(entity pred) .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); + GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE, VOL_BASE); + + // yes, hard coded sound length. I know it's bad but what can I do? + if(cvar("g_healthsize") && cvar("g_healthsize_pitch")) + self.gurglesound_finished = time + 11 * pow(self.scale, -cvar("g_healthsize_pitch")); // modified sound pitch, based on player scale + else + self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do? - self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do? self.gurgle_oldstomachload = self.stomach_load; } } +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(g_rpg) + return; // RPG is choice based, so don't do things automatically there + 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(clienttype(e) != CLIENTTYPE_REAL) + return; // this feature is only for players, not bots + 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 prey_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) @@ -167,51 +192,47 @@ void Vore_StomachLoad_Apply() prey_mass = cvar("g_balance_vore_load_prey_mass"); if(cvar("g_healthsize")) prey_mass *= e.scale; - self.stomach_load += floor(prey_mass); + 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"); + self.gravity = 1 * (cvar("g_healthsize") ? pow(self.scale, cvar("g_healthsize_weight")) : 1) + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_weight"); if(!self.gravity && self.stomach_load) 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() +float Vore_GulletModel_CustomizeEntityForClient() { // use the same system as the weapon model self.viewmodelforclient = self.owner; - self.alpha = self.owner.cvar_cl_vore_swallowmodel; + self.alpha = self.owner.cvar_cl_vore_gulletmodel; if(other.classname == "spectator") if(other.enemy == self.owner) { self.viewmodelforclient = other; - self.alpha = other.cvar_cl_vore_swallowmodel; + self.alpha = other.cvar_cl_vore_gulletmodel; } return TRUE; } -void Vore_SwallowModel_Think() +void Vore_GulletModel_Think() { // update the position of the swallow model to match our swallow progress float dist; @@ -232,7 +253,7 @@ void Vore_SwallowModel_Think() self.nextthink = time; } -void Vore_SwallowModel_Update(entity prey, entity pred) +void Vore_GulletModel_Update(entity prey, entity pred) { // if we don't have a swallow model already, spawn one if(!prey.swallow_model) @@ -243,16 +264,16 @@ void Vore_SwallowModel_Update(entity prey, entity pred) //prey.swallow_model.effects |= EF_NOGUNBOB; // let it bob prey.swallow_model.effects |= EF_NODEPTHTEST; // don't hide behind walls prey.swallow_model.owner = prey; - prey.swallow_model.customizeentityforclient = Vore_SwallowModel_CustomizeEntityForClient; - prey.swallow_model.think = Vore_SwallowModel_Think; + prey.swallow_model.customizeentityforclient = Vore_GulletModel_CustomizeEntityForClient; + prey.swallow_model.think = Vore_GulletModel_Think; prey.swallow_model.nextthink = time; } // properties that should update whenever possible, but when the predator is available - string player_swallowmodel; - player_swallowmodel = strcat(substring(pred.playermodel, 0, strlen(pred.playermodel) - 4), "_swallow.md3"); // 4 is the extension length - if(prey.swallow_model.model != player_swallowmodel) // player model can be changed while the predator is active - setmodel(prey.swallow_model, player_swallowmodel); + string player_gulletmodel; + player_gulletmodel = strcat(substring(pred.playermodel, 0, strlen(pred.playermodel) - 4), "_gullet.iqm"); // 4 is the extension length + if(prey.swallow_model.model != player_gulletmodel) // player model can be changed while the predator is active + setmodel(prey.swallow_model, player_gulletmodel); if(prey.swallow_model.skin != pred.skin) // player skin can be changed while the predator is active prey.swallow_model.skin = pred.skin; if(cvar("g_healthsize")) @@ -273,6 +294,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); @@ -281,6 +303,9 @@ void Vore_Swallow(entity e) e.solid = SOLID_NOT; e.aiment = e.predator; // follow the predator, automatically unset when regurgitated + float scalediff; + scalediff = cvar("g_healthsize") ? e.scale / e.predator.scale : 1; // the tighter the gut, the greater the effect + // drop keys (KH) and flags (CTF) when we get swallowed kh_Key_DropAll(e, FALSE); if(e.flagcarried) @@ -299,11 +324,12 @@ 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 = crandom() * cvar("g_balance_vore_swallow_predator_punchangle") * scalediff; + e.predator.punchangle_y = crandom() * cvar("g_balance_vore_swallow_predator_punchangle") * scalediff; + e.predator.punchangle_z = crandom() * cvar("g_balance_vore_swallow_predator_punchangle") * scalediff; 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 @@ -315,23 +341,38 @@ void Vore_Swallow(entity e) void Vore_SwallowStep(entity e) { - if(!cvar("g_balance_vore_swallow_speed_fill")) + if(!cvar("g_balance_vore_swallow_speed_fill_player")) { Vore_Swallow(e); return; } - Vore_SwallowModel_Update(e, self); + // when the predator starts swallowing, play his grab sound + if(!self.swallow_progress_pred) + PlayerSound(self, playersound_grab, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + + Vore_GulletModel_Update(e, self); // increase the progress value until it reaches 1, then swallow the player if(e.swallow_progress_prey < 1) { float fill; - fill = cvar("g_balance_vore_swallow_speed_fill") * frametime; - 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")); + fill = cvar("g_balance_vore_swallow_speed_fill_player") * frametime; + if(cvar("g_healthsize") && cvar("g_balance_vore_swallow_speed_fill_scalediff_player")) // fill rate depends on predator size compared to prey size + fill *= pow(self.scale / e.scale, cvar("g_balance_vore_swallow_speed_fill_scalediff_player")); 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))); + + // skill-based speed offset for bots + if(skill && cvar("skill_offset")) + { + float ofs; + ofs = pow(skill / cvar("skill_offset_center"), cvar("skill_offset")); + if(clienttype(self) == CLIENTTYPE_BOT) + fill *= ofs; + if(clienttype(e) == CLIENTTYPE_BOT) + fill /= ofs; + } e.swallow_progress_prey += fill; } @@ -353,27 +394,36 @@ 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(cvar("g_balance_vore_regurgitate_death_silent")) + if(e.deadflag != DEAD_NO && e.health <= cvar("g_balance_vore_digestion_limit")) + { + e.predator = world; + e.modelindex = 0; // hide the dead body + return; + } + + float scalediff; + scalediff = cvar("g_healthsize") ? e.scale / e.predator.scale : 1; // the tighter the gut, the greater the effect // 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.velocity = v_forward * cvar("g_balance_vore_regurgitate_force") * scalediff; + e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce") * scalediff; 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")) + if(cvar("g_balance_vore_swallow_speed_fill_player") && cvar("g_balance_vore_regurgitate_swallowprogress")) { e.swallow_progress_prey = cvar("g_balance_vore_regurgitate_swallowprogress"); - Vore_SwallowModel_Update(e, e.predator); + Vore_GulletModel_Update(e, e.predator); } // apply regurgitation damage to the predator @@ -383,13 +433,15 @@ 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"); + pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', floor(scalediff * PARTICLE_MULTIPLIER)); + e.predator.punchangle_x = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle") * scalediff; + e.predator.punchangle_y = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle") * scalediff; + e.predator.punchangle_z = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle") * scalediff; e.predator.regurgitate_prepare = 0; e.predator.action_delay = time + cvar("g_balance_vore_action_delay"); Vore_SetPreyPositions(e.predator); @@ -400,9 +452,10 @@ void Vore_Regurgitate(entity e) e.predator = world; } -void Vore_Disconnect() +void Vore_Disconnect(float consumables) { // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances + entity e; // prey disconnects or goes spectating while inside someone's belly if(self.stat_eaten) @@ -415,9 +468,18 @@ void Vore_Disconnect() if(head.predator == self) Vore_Regurgitate(head); } - Vore_GurgleSound(); // stop the gurgling sound + // remove consumable items when we disconnect + if(consumables) + { + for(e = world; (e = find(e, classname, "consumable")); ) + { + if(e.predator == self) + Item_Consumable_Remove(e, TRUE); + } + } self.stomach_load = self.gravity = 0; // prevents a bug + Vore_GurgleSound(); // stop the gurgling sound } .float digestion_step; @@ -425,30 +487,38 @@ 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; - vore_offset = 1; + float damage, damage_offset; + + damage_offset = 1; if(cvar("g_balance_vore_digestion_distribute")) // apply distributed digestion damage - vore_offset *= self.predator.stomach_load / self.predator.stomach_maxload; + damage_offset /= (1 - (self.predator.stomach_load / self.predator.stomach_maxload) * bound(0, cvar("g_balance_vore_digestion_distribute"), 1)); if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff")) // apply player scale to digestion damage - vore_offset *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_digestion_scalediff")); - vore_offset = ceil(vore_offset); + damage_offset *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_digestion_scalediff")); - float damage; - damage = cvar("g_balance_vore_digestion_damage") / vore_offset; + if(self.deadflag != DEAD_NO) + damage = cvar("g_balance_vore_digestion_damage_death") / damage_offset; + else + damage = cvar("g_balance_vore_digestion_damage") / damage_offset; 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(stov(cvar_string("g_vore_regurgitatecolor_color_digest"))) @@ -460,11 +530,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")) @@ -480,27 +553,41 @@ 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; + + float scalediff; + scalediff = pow(self.scale / self.predator.scale, cvar("g_balance_vore_kick_scalediff")); + if(time > self.stomachkick_delay && !self.kick_pressed) { - float damage, vol; + float damage, vol, pitch; vector force; damage = cvar("g_balance_vore_kick_damage"); force = v_forward * cvar("g_balance_vore_kick_force"); vol = VOL_BASE; + // modified sound pitch, based on player scale + if(cvar("g_healthsize") && cvar("g_healthsize_pitch")) + pitch = pow(self.predator.scale, -cvar("g_healthsize_pitch")); + // apply player scale to the damage / force of the kick if(cvar("g_healthsize") && cvar("g_balance_vore_kick_scalediff")) { - damage *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_kick_scalediff")); - force *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_kick_scalediff")); - vol *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_kick_scalediff")); // kick sound volume based on the same scale + damage *= scalediff; + force *= scalediff; + vol *= scalediff; // kick sound volume based on the same scale } vol = bound(0, vol, 1); Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, force); - sound(self.predator, CHAN_PROJECTILE, strcat("weapons/hit", ftos(floor(random() * 8)), ".wav"), vol, ATTN_NORM); - self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle"); - self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle"); + sound7(self.predator, CHAN_PROJECTILE, strcat("weapons/hit", ftos(floor(random() * 8)), ".wav"), vol, ATTN_NORM, 100 * pitch, 0); + self.predator.punchangle_x = crandom() * cvar("g_balance_vore_kick_predator_punchangle") * scalediff; + self.predator.punchangle_y = crandom() * cvar("g_balance_vore_kick_predator_punchangle") * scalediff; + self.predator.punchangle_z = crandom() * cvar("g_balance_vore_kick_predator_punchangle") * scalediff; + self.punchangle_x = crandom() * cvar("g_balance_vore_kick_prey_punchangle") * scalediff; + self.punchangle_y = crandom() * cvar("g_balance_vore_kick_prey_punchangle") * scalediff; + self.punchangle_z = crandom() * cvar("g_balance_vore_kick_prey_punchangle") * scalediff; // abort the predator's scheduled regurgitation if(random() < cvar("g_balance_vore_kick_cutregurgitate")) @@ -517,6 +604,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) @@ -534,7 +624,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 { @@ -549,7 +639,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 { @@ -639,7 +729,7 @@ void Vore() if(cvar("g_vore_regurgitatecolor_particles")) if(self.regurgitatecolor_particles_tick < time) { - pointparticles(particleeffectnum("vore_regurgitate_constant"), self.origin, '0 0 0', 1); + pointparticles(particleeffectnum("vore_regurgitate_constant"), self.origin, '0 0 0', floor((cvar("g_healthsize") ? self.scale : 1) * PARTICLE_MULTIPLIER)); self.regurgitatecolor_particles_tick = time + cvar("g_vore_regurgitatecolor_particles") * vlen(self.colormod); // particle time depends on how dirty the player is } } @@ -666,41 +756,15 @@ 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")) { if(self.swallow_progress_pred) - { - self.swallow_progress_pred -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; - if(self.swallow_progress_pred < 0) - self.swallow_progress_pred = 0; - } + self.swallow_progress_pred = max(0, self.swallow_progress_pred - cvar("g_balance_vore_swallow_speed_decrease") * frametime); if(self.swallow_progress_prey) - { - self.swallow_progress_prey -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; - if(self.swallow_progress_prey < 0) - self.swallow_progress_prey = 0; - } + self.swallow_progress_prey = max(0, self.swallow_progress_prey - cvar("g_balance_vore_swallow_speed_decrease") * frametime); } // set the predator's stomach load and capacity @@ -709,12 +773,12 @@ void Vore() // apply delays and skip the vore system under some circumstances if(!cvar("g_vore")) // the vore system is disabled { - Vore_Disconnect(); + Vore_Disconnect(TRUE); return; } if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins { - Vore_Disconnect(); + Vore_Disconnect(FALSE); return; } if(self.spectatee_status) @@ -768,6 +832,7 @@ void Vore() // predator wishes to regurgitate his prey if(self.BUTTON_REGURGITATE && time > self.action_delay) + if(!self.regurgitate_prepare) { if(self.stomach_load) { @@ -787,6 +852,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(); @@ -797,34 +879,34 @@ void Vore() if(!self.stat_eaten) return; - /*if(self.deadflag != DEAD_NO) // we're dead, do what we must - { - Vore_Regurgitate(self); - return; - }*/ + 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"); - if(self.predator.deadflag != DEAD_NO) // do we want to be in a dead furry x_x - { - Vore_Regurgitate(self); - return; - } - if(self.predator.stomach_load > self.predator.stomach_maxload) // the predator got beyond his capacity after eating, so some prey must pop out + // 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_Regurgitate(self); return; } - 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)) // predator's going too fast, gets sick and throws up + + // do we stick around inside dead furries? x_x + if(self.predator.deadflag != DEAD_NO) { - Vore_Regurgitate(self); - return; + 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) { - self.predator.regurgitate_prepare = 0; - self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach Vore_Regurgitate(self); + self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach } // execute digesting and team healing @@ -848,4 +930,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); -} \ No newline at end of file + + // 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; +}