X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=e47b06553a0be0af23502af82b28181c5ef4861d;hb=ceb24eb734d894254c4e32a51240aa66f16e8c7f;hp=0b0e01cd115677bd1d5fa31959204123b95d9f1c;hpb=e79a9bac1c149bc0f0488f33508007586a8cb9af;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 0b0e01cd..e47b0655 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -199,6 +199,64 @@ void Vore_AutoDigest(entity e) e.digesting = TRUE; } +.entity swallow_model; +void Vore_SwallowModel_Think() +{ + //update the position of the swallow model to match our swallow progress + float dist; + dist = (-0.5 + self.owner.swallow_progress_prey) * cvar("g_vore_swallowmodel_range"); // the model is centered at 0.5 progress + if(cvar("g_healthsize")) + dist *= self.scale; + self.view_ofs = '1 0 0' * dist; + + // if our swallow progress is gone or we are dead, the swallow model also goes away + if(!self.owner.swallow_progress_prey || self.owner.deadflag != DEAD_NO || self.owner.classname != "player") + { + remove(self.owner.swallow_model); + self.owner.swallow_model = world; + return; + } + + // properties that should update whenever possible, but when the predator is not available + self.alpha = self.owner.cvar_cl_vore_swallowmodel; + self.nextthink = time; +} + +void Vore_SwallowModel_Update(entity prey, entity pred) +{ + // if we don't have a swallow model already, spawn one + if(!prey.swallow_model) + { + prey.swallow_model = spawn(); + + prey.swallow_model.movetype = MOVETYPE_FOLLOW; + prey.swallow_model.solid = SOLID_NOT; + + // apply the properties of the prey + prey.swallow_model.viewmodelforclient = prey; // use the same system as the weapon model + //prey.swallow_model.effects |= EF_NOGUNBOB; // let it bob + prey.swallow_model.effects |= EF_NODEPTHTEST; // don't hide behind walls + prey.swallow_model.colormap = prey.colormap; // pants and shirt color + prey.swallow_model.glowmod = prey.glowmod; // glow color + + prey.swallow_model.owner = prey; // owned by the prey + prey.swallow_model.think = Vore_SwallowModel_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); + 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")) + prey.swallow_model.scale = pred.scale / prey.scale; // player size difference + if(prey.swallow_model.enemy != pred) + prey.swallow_model.enemy = pred; // enemy is the predator +} + .entity pusher; .float pushltime; void Vore_Swallow(entity e) @@ -231,12 +289,13 @@ void Vore_Swallow(entity e) centerprint(e.predator, "^3You have swallowed a team mate, don't digest!"); } - PlayerSound(e.predator, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + 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.stomach_load += 1; 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_WeightApply(e.predator); Vore_AutoDigest(e.predator); @@ -247,6 +306,38 @@ void Vore_Swallow(entity e) e.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); // don't kick immediately after being swallowed } +void Vore_SwallowStep(entity e) +{ + if(!cvar("g_balance_vore_swallow_speed_fill")) + { + Vore_Swallow(e); + return; + } + + Vore_SwallowModel_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_balance_vore_swallow_speed_fill_scalediff")) // fill rate depends on predator size compared to prey size + fill *= (self.scale / e.scale); + 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; + + e.swallow_progress_prey += fill; + } + else + { + Vore_Swallow(e); + e.swallow_progress_prey = 0; + } + + // the predator's progress is how much the prey got swallowed + self.swallow_progress_pred = e.swallow_progress_prey; +} + void Vore_Regurgitate(entity e) { // this player is being regurgitated by their predator, apply the proper changes @@ -271,9 +362,26 @@ void Vore_Regurgitate(entity e) e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits e.pushltime = time + cvar("g_maxpushtime"); - PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + // 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")) + { + e.swallow_progress_prey = cvar("g_balance_vore_regurgitate_swallowprogress"); + Vore_SwallowModel_Update(e, e.predator); + } + + // apply regurgitation damage to the predator + if(cvar("g_balance_vore_regurgitate_damage")) + { + float regurgitate_dmg; + 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'); + } + + 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("regurgitate"), e.predator.origin, '0 0 0', 1); + pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', 1); e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle"); e.predator.stomach_load -= 1; e.predator.regurgitate_prepare = 0; @@ -378,7 +486,14 @@ void Vore_Digest() else reduce = 1; - Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage") / reduce, DEATH_DIGESTION, self.origin, '0 0 0'); + float damage; + damage = cvar("g_balance_vore_digestion_damage") / reduce; + + // apply player scale to digestion damage + if(cvar("g_balance_vore_digestion_scalediff")) + damage *= (self.predator.scale / self.scale); + + 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") / reduce; @@ -415,21 +530,38 @@ void Vore_Teamheal() } } +.float kick_pressed; void Vore_StomachKick() { // allows prey to kick the predator's stomach and do some damage or attempt to escape - if(time > self.stomachkick_delay) + if(time > self.stomachkick_delay && !self.kick_pressed) { float damage; + vector force; damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min")); + force = v_forward * cvar("g_balance_vore_kick_force"); - Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * cvar("g_balance_vore_kick_force")); - sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.wav", VOL_BASE, ATTN_NORM); + // apply player scale to the damage / force of the kick + if(cvar("g_balance_vore_kick_scalediff")) + { + damage *= (self.scale / self.predator.scale); + force *= (self.scale / self.predator.scale); + } + + 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_BASE, ATTN_NORM); self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle"); self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle"); + // abort the predator's scheduled regurgitation + if(random() < cvar("g_balance_vore_kick_cutregurgitate")) + self.predator.regurgitate_prepare = 0; + self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); + if(cvar("g_balance_vore_kick_repress")) + if not(clienttype(self) == CLIENTTYPE_BOT) // not for bots, to prevent an issue + self.kick_pressed = TRUE; } } @@ -494,20 +626,31 @@ void Vore_SetSbarRings() { if(time <= self.stomachkick_delay) { - self.stat_sbring1_type = 2; // ring shows stomach kick delay, empties with progress + self.stat_sbring1_type = 3; // ring shows stomach kick delay, empties with progress 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); } } else { - if(time <= self.action_delay) + if(self.swallow_progress_pred) + { + self.stat_sbring1_type = 1; // ring shows predator swallow progress, fills with progress + self.stat_sbring1_clip = bound(0, self.swallow_progress_pred, 1); + } + else if(time <= self.action_delay) { - self.stat_sbring1_type = 1; // ring shows vore action delay, empties with progress + self.stat_sbring1_type = 2; // ring shows vore action delay, empties with progress 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); } - if(time <= self.regurgitate_prepare) + + if(self.swallow_progress_prey) { - self.stat_sbring2_type = 1; // ring shows regurgitation preparing, fills with progress + self.stat_sbring2_type = 1; // ring shows prey swallow progress, fills with progress + self.stat_sbring2_clip = bound(0, self.swallow_progress_prey, 1); + } + else if(time <= self.regurgitate_prepare) + { + self.stat_sbring2_type = 2; // ring shows regurgitation preparing, fills with progress 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); } } @@ -517,12 +660,6 @@ void Vore() { // main vore code, this is where it all happens - if(!cvar("g_vore")) // the vore system is disabled - { - Vore_Disconnect(); - return; - } - Vore_AutoTaunt(); // wash the goo away from players once they leave the stomach @@ -584,7 +721,29 @@ void Vore() } } + // 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; + } + 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; + } + } + // apply delays and skip the vore system under some circumstances + if(!cvar("g_vore")) // the vore system is disabled + { + Vore_Disconnect(); + return; + } if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins { Vore_Disconnect(); @@ -613,7 +772,7 @@ void Vore() self.stat_canswallow = 1; if(self.BUTTON_ATCK) - Vore_Swallow(prey); + Vore_SwallowStep(prey); } else if(prey != world) self.stat_canswallow = -1; @@ -703,8 +862,13 @@ void Vore() Vore_Teamheal(); // execute prey commands - if(self.BUTTON_ATCK && cvar("g_vore_kick")) - Vore_StomachKick(); + if(self.BUTTON_ATCK) + { + if(cvar("g_vore_kick")) + Vore_StomachKick(); + } + else + self.kick_pressed = FALSE; if(self.BUTTON_JUMP) Vore_StomachLeave();