X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=76dca4064a07d087c4cfabf0e15adef00bde6cdd;hb=26226159c0b283300257726c80bfe81ade915db8;hp=70ad166b1101ea21406c0322b612b28f007eeb56;hpb=069a6c4875214391ef2308fed24409b501de7db6;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 70ad166b..76dca406 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -16,12 +16,15 @@ entity Swallow_player_check() vector vore_w_shotorg, vore_w_shotdir; swallow_range = cvar("g_balance_vore_swallow_range"); - if(self.scale) // we can swallow from further or closer based on our size + if(cvar("g_healthsize")) // we can swallow from further or closer based on our size swallow_range *= self.scale; vore_w_shotorg = self.origin; vore_w_shotdir = v_forward; - WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * swallow_range, FALSE, self, ANTILAG_LATENCY(self)); + if(self.antilag_debug) + WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * swallow_range, FALSE, self, self.antilag_debug); + else + WarpZone_traceline_antilag(self, vore_w_shotorg, vore_w_shotorg + vore_w_shotdir * swallow_range, FALSE, self, ANTILAG_LATENCY(self)); if(trace_fraction < 1) if(trace_ent.classname == "player") return trace_ent; @@ -36,7 +39,7 @@ float Swallow_condition_check(entity prey) if(prey.classname == "player" && !prey.stat_eaten && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach 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) - if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) + if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap") / (1 + self.stomach_load)) { string swallow_complain; if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore")) @@ -235,6 +238,7 @@ void Vore_SwallowModel_Update(entity prey, entity pred) // 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 @@ -294,6 +298,7 @@ void Vore_Swallow(entity e) 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); @@ -319,8 +324,8 @@ void Vore_SwallowStep(entity e) { 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_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; @@ -367,9 +372,19 @@ void Vore_Regurgitate(entity e) 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; @@ -478,8 +493,8 @@ void Vore_Digest() 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); + if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff")) + damage *= pow(self.predator.scale / self.scale, cvar("g_balance_vore_digestion_scalediff")); 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")) @@ -525,20 +540,23 @@ void Vore_StomachKick() if(time > self.stomachkick_delay && !self.kick_pressed) { - float damage; + float damage, vol; 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")); + damage = cvar("g_balance_vore_kick_damage"); force = v_forward * cvar("g_balance_vore_kick_force"); + vol = VOL_BASE; // apply player scale to the damage / force of the kick - if(cvar("g_balance_vore_kick_scalediff")) + if(cvar("g_healthsize") && cvar("g_balance_vore_kick_scalediff")) { - damage *= (self.scale / self.predator.scale); - force *= (self.scale / self.predator.scale); + 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 } + 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_BASE, ATTN_NORM); + 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"); @@ -548,7 +566,7 @@ void Vore_StomachKick() self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); if(cvar("g_balance_vore_kick_repress")) - if(clienttype(self) != CLIENTTYPE_BOT) // bots don't need to re-press to kick + if not(clienttype(self) == CLIENTTYPE_BOT) // not for bots, to prevent an issue self.kick_pressed = TRUE; } } @@ -644,16 +662,11 @@ void Vore_SetSbarRings() } } +.entity prey; 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 @@ -733,6 +746,11 @@ void Vore() } // 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(); @@ -747,23 +765,22 @@ void Vore() // Code that addresses predators: // -------------------------------- - entity prey; - prey = Swallow_player_check(); + self.prey = Swallow_player_check(); // 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)) + if(Swallow_condition_check(self.prey)) { // canswallow stat, used by the HUD - if(teams_matter && prey.team == self.team) + if(teams_matter && self.prey.team == self.team) self.stat_canswallow = 2; else self.stat_canswallow = 1; if(self.BUTTON_ATCK) - Vore_SwallowStep(prey); + Vore_SwallowStep(self.prey); } - else if(prey != world) + else if(self.prey != world) self.stat_canswallow = -1; // toggle digestion, if the player has someone in their stomach @@ -796,6 +813,7 @@ void Vore() { self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay"); PlayerSound(self, playersound_regurgitate_prepare, CHAN_VOICE, VOICETYPE_PLAYERSOUND); + setanim(self, self.anim_pain2, FALSE, TRUE, TRUE); // looks good for preparing regurgitation self.regurgitate_button_delay_time = time + button_delay_time; } } @@ -832,7 +850,7 @@ void Vore() if(self.predator.deadflag != DEAD_NO) Vore_Regurgitate(self); - else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) + else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap") / (1 + self.predator.stomach_load)) Vore_Regurgitate(self); // apply delayed regurgitating if it was scheduled