X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fvore.qc;h=268798a0c11fad9af8803a7360e0394876df267f;hp=d6398650d7c4ef6509c7ad190779323ddddf036e;hb=d4f082640c5df19a5e3aa01b0326870d07820e2f;hpb=8aaeee64de4f5a355f916c97dec5a6bd1bb7709a diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index d6398650..268798a0 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -1,9 +1,10 @@ .float regurgitate_prepare; -.float swallow_delay, digest_button_delay, regurgitate_button_delay; +.float system_delay, swallow_delay, digest_button_delay, regurgitate_button_delay; .float complain_swallow; const float complain_delay = 1; const float button_delay = 0.5; const float steptime = 0.1; +const float system_delay_time = 0.1; .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload; @@ -79,7 +80,7 @@ void Vore_Swallow(entity e) e.alpha = -1; // best way of hiding / showing the eaten player e.aiment = e.eater; // follow the predator. Is automatically unset e.view_ofs_z /= 2; // best positioning for the stomach model - e.stat_eaten = TRUE; + e.stat_eaten = num_for_edict(e.eater); // drop keys (KH) and flags (CTF) when we get swallowed kh_Key_DropAll(e, FALSE); @@ -94,6 +95,8 @@ void Vore_Swallow(entity e) e.eater.stomach_load += 1; e.eater.regurgitate_prepare = 0; Vore_Weight_apply(e.eater); + + e.system_delay = e.eater.system_delay = time + system_delay_time; } void Vore_Regurgitate(entity e) @@ -102,22 +105,31 @@ void Vore_Regurgitate(entity e) e.movetype = e.vore_oldmovetype; if(e.health > 0) // leave SOLID_NOT for dead bodies e.solid = e.vore_oldsolid; - e.alpha = 0; // best way of hiding / showing the eaten player + e.alpha = default_player_alpha; // best way of hiding / showing the eaten player e.view_ofs_z *= 2; // best positioning for the stomach model - e.stat_eaten = FALSE; + e.stat_eaten = 0; // velocities - vector rand; - rand = (randomvec() - randomvec()); - e.velocity = rand * cvar("g_balance_vore_regurgitate_force"); - e.eater.velocity += rand * cvar("g_balance_vore_regurgitate_eaterforce"); + local vector oldforward, oldright, oldup; + oldforward = v_forward; + oldright = v_right; + oldup = v_up; + makevectors(e.eater.v_angle); + e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force"); + e.eater.velocity += -v_forward * cvar("g_balance_vore_regurgitate_eaterforce"); + v_forward = oldforward; + v_right = oldright; + v_up = oldup; PlayerSound(e.eater, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND); setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing \ regurgitating pointparticles(particleeffectnum("regurgitate"), e.eater.origin, '0 0 0', 1); e.eater.stomach_load -= 1; e.eater.regurgitate_prepare = 0; + e.eater.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); Vore_Weight_apply(e.eater); + + e.system_delay = e.eater.system_delay = time + system_delay_time; e.eater = world; } @@ -129,7 +141,7 @@ void Vore_Disconnect() if(self.eater.classname == "player") { self.view_ofs_z += 25; - self.stat_eaten = FALSE; + self.stat_eaten = 0; self.eater.stomach_load -= 1; Vore_Weight_apply(self.eater); self.eater = world; @@ -160,7 +172,7 @@ void Vore_Digest() if (self.eater.digestsound_finished < time) { self.eater.digestsound_finished = time + 0.5; - sound (self.eater, CHAN_PLAYER, "player/digest.wav", VOL_BASE, ATTN_NORM); + PlayerSound (self.eater, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); } self.eater.digestion_step = time; } @@ -184,32 +196,53 @@ void Vore_Teamheal() .float stomachkick_delay; void Vore_StomachKick() { - // allows prey to kick the predator's stomach and do some damage, or bring the predator's digestion upon their self when there's no other option + // allows prey to kick the predator's stomach and do some damage / attempt to escape, or bring the predator's digestion upon their self when there's no other option if(self.eater.classname != "player") return; - // kick the predator's stomach and do damage + // kick the predator's stomach and do damage, or escape if we are lucky if(self.BUTTON_ATCK) if(time > self.stomachkick_delay) { float damage; 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(self.eater, self, self, damage, DEATH_STOMACHKICK, self.eater.origin, '0 0 0'); sound(self.eater, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM); + + if(cvar("g_balance_vore_kick_escapeprobability") >= random()) + Vore_Regurgitate(self); + self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); } // start the predator's digestion if(self.BUTTON_ATCK2) { - centerprint(self.eater, strcat(self.netname, " triggered your digestion")); + centerprint(self.eater, strcat(self.netname, " has triggered your digestion")); self.eater.digesting = TRUE; } } +.float gurglesound_finished, gurglesound_oldstomachload; +void Vore_Gurglesound() +{ + if(time > self.gurglesound_finished || self.gurglesound_oldstomachload != self.stomach_load) + { + GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE); + + self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do? + self.gurglesound_oldstomachload = self.stomach_load; + } +} + void Vore() { + // if we are free, show our stomach load on the HUD. Otherwise, show the predator's + if(self.eater.classname == "player") + self.stat_stomachload = self.eater.stomach_load; + else + self.stat_stomachload = self.stomach_load; + // skip the vore system under some circumstances if(time < game_starttime) { @@ -218,6 +251,8 @@ void Vore() } if(self.spectatee_status) return; + if(time < self.system_delay) + return; // -------------------------------- // Code that addresses predators: @@ -282,6 +317,9 @@ void Vore() } } + if(cvar("g_vore_gurglesound")) + Vore_Gurglesound(); + // -------------------------------- // Code that addresses the prey: // --------------------------------