From: MirceaKitsune Date: Thu, 9 Sep 2010 01:10:27 +0000 (+0300) Subject: Many cosmetic changes and rearrangements in the vore code X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9e5ff31eeb9c68d4b6aabbde33591eb2048b3573;p=voretournament%2Fvoretournament.git Many cosmetic changes and rearrangements in the vore code --- diff --git a/data/effectinfo.txt b/data/effectinfo.txt index 748f17f2..80602e4d 100644 --- a/data/effectinfo.txt +++ b/data/effectinfo.txt @@ -4607,6 +4607,8 @@ velocitymultiplier 20 velocityoffset 0 0 10 airfriction 1 +// regurgitate effect +// used in: vore.qc: pointparticles(particleeffectnum("regurgitate"), e.predator.origin, '0 0 0', 1) effect regurgitate count 30 type blood @@ -4629,4 +4631,4 @@ tex 0 8 size 25 30 alpha 100 256 400 color 0x000000 0x408000 -originjitter 110 110 110 \ No newline at end of file +originjitter 110 110 110 diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index 92debac8..6d316524 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -196,8 +196,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart .float killcount; .float hitsound, typehitsound; -.float watersound_finished; -.float digestsound_finished; +.float watersound_finished, digestsound_finished, gurglesound_finished; .float iscreature; .vector oldvelocity; diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 2034b1cf..fdbff4d9 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -1,16 +1,17 @@ .float regurgitate_prepare; -.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 system_delay, swallow_delay, digest_button_delay_time, regurgitate_button_delay_time; +.float complain_vore; .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload, vore_oldview_ofs_z; +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_distance_check() { // check if we can swallow a player instead of firing our weapon + vector w_shotorg, w_shotdir; w_shotorg = self.origin + self.view_ofs; w_shotdir = v_forward; @@ -25,17 +26,18 @@ entity Swallow_distance_check() float Swallow_condition_check(entity prey) { // checks the necessary conditions for swallowing another player + if(prey.classname == "player" && prey.predator.classname != "player" && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach if(self.classname == "player" && self.predator.classname != "player" && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) { if(self.stomach_load >= cvar("g_balance_vore_swallow_limit")) { - if(time > self.complain_swallow) + if(time > self.complain_vore) { play2(self, "weapons/unavailable.wav"); sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n")); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } return FALSE; } @@ -43,20 +45,21 @@ float Swallow_condition_check(entity prey) if(cvar("g_vore_biggergut")) if(prey.stomach_load > self.stomach_load) { - if(time > self.complain_swallow) + if(time > self.complain_vore) { play2(self, "weapons/unavailable.wav"); sprint(self, "You cannot swallow someone with a bigger stomach than yours\n"); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } return FALSE; } + return TRUE; } return FALSE; } -float Vore_PreyCanLeave() +float Vore_CanLeave() { if(teams_matter && self.team == self.predator.team) return TRUE; @@ -64,7 +67,7 @@ float Vore_PreyCanLeave() } // make the camera smoothly lower itself when we get swallowed -// the target we are going for is from normal view offset to half of the view offset (because half is the best positioning of the view for the stomach model) +// our aim is going from the normal view offset to half of the view offset (because half is the best positioning for the stomach model) .float cameraeffect_current, cameraeffect_target; void Vore_CameraEffect_Set(entity e) { @@ -93,14 +96,27 @@ void Vore_CameraEffect_Apply() self.view_ofs_z = self.vore_oldview_ofs_z / self.cameraeffect_current; } +.float gurgle_oldstomachload; +void Vore_Gurglesound() +{ + if(time > self.gurglesound_finished || self.gurgle_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.gurgle_oldstomachload = self.stomach_load; + } +} + void Vore_Weight_apply(entity e) { // apply stomach weight that makes you heavier the more you eat - // slowing the player is applied in cl_physics.qc + // slowing the player is done in cl_physics.qc + if(e.stomach_load != e.vore_oldstomachload) e.gravity += 1 + (e.stomach_load * cvar("g_balance_vore_weight_gravity") - e.vore_oldstomachload); if(e.gravity == 0) - e.gravity = 0.00001; // 0 becomes 1 for .gravity, so do this to allow 0 gravity + e.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity e.vore_oldstomachload = e.stomach_load; } @@ -108,7 +124,8 @@ void Vore_Weight_apply(entity e) .float pushltime; void Vore_Swallow(entity e) { - // this player is beening swallowed by another player, apply the proper changes + // this player is being swallowed by another player, apply the proper changes + e.vore_oldmovetype = e.movetype; e.vore_oldsolid = e.solid; e.vore_oldview_ofs_z = e.view_ofs_z; @@ -118,8 +135,8 @@ void Vore_Swallow(entity e) e.velocity = '0 0 0'; e.movetype = MOVETYPE_FOLLOW; e.solid = SOLID_NOT; - e.alpha = -1; // best way of hiding / showing the eaten player - e.aiment = e.predator; // follow the predator. Is automatically unset + e.alpha = -1; // best way of hiding the eaten player + e.aiment = e.predator; // follow the predator, automatically unset when regurgitated // drop keys (KH) and flags (CTF) when we get swallowed kh_Key_DropAll(e, FALSE); @@ -131,7 +148,7 @@ void Vore_Swallow(entity e) if(stov(cvar_string("g_vore_regurgitatecolor_release"))) e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release")); - if(e.team == e.predator.team && teamplay) + if(teams_matter && e.team == e.predator.team) { centerprint(e, "^3You have been swallowed by a team mate, don't kick!"); centerprint(e.predator, "^3You have swallowed a team mate, use caution!"); @@ -143,22 +160,23 @@ void Vore_Swallow(entity e) e.predator.regurgitate_prepare = 0; Vore_Weight_apply(e.predator); - // block firing for a small amount of time when voring, or we'll be firing the next frame after we swallow - e.predator.weapon_delay = time + button_delay; + // 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; e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); e.system_delay = e.predator.system_delay = time + system_delay_time; } void Vore_Regurgitate(entity e) { - // this player is being released from their predator, apply the proper changes + // this player is being regurgitated by their predator, apply the proper changes + e.movetype = e.vore_oldmovetype; if(e.health > 0) // leave SOLID_NOT for dead bodies e.solid = e.vore_oldsolid; e.view_ofs_z = e.vore_oldview_ofs_z; - e.alpha = default_player_alpha; // best way of hiding / showing the eaten player + e.alpha = default_player_alpha; - // velocities + // apply velocities local vector oldforward, oldright, oldup; oldforward = v_forward; oldright = v_right; @@ -170,7 +188,7 @@ void Vore_Regurgitate(entity e) v_right = oldright; v_up = oldup; - e.pusher = e.predator; // so we can frag players by regurgitating them in deadly pits + 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); @@ -181,22 +199,21 @@ void Vore_Regurgitate(entity e) e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay"); Vore_Weight_apply(e.predator); - // block firing for a small amount of time when getting regurgitated, or we'll be firing the next frame - e.weapon_delay = time + button_delay; + // block firing for a small amount of time, or we'll be firing the next frame + e.weapon_delay = time + button_delay_time; e.system_delay = e.predator.system_delay = time + system_delay_time; e.predator = world; } -void Vore_Gurglesound(); void Vore_Disconnect() { - // frees prey from their predators when someone disconnects or goes spectating + // 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: + // prey disconnects or goes spectating while inside someone's belly if(self.predator.classname == "player") Vore_Regurgitate(self); - // pred disconnects or goes spectating with players in their belly: + // pred disconnects or goes spectating with players in their belly else if(self.stomach_load > 0) { entity head; @@ -213,7 +230,8 @@ void Vore_Disconnect() void Vore_Digest() { // apply digestion to prey - if(time > self.predator.digestion_step + steptime) + + if(time > self.predator.digestion_step) { Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_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")) @@ -221,10 +239,10 @@ void Vore_Digest() if (self.predator.digestsound_finished < time) { - self.predator.digestsound_finished = time + 0.5; PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND); + self.predator.digestsound_finished = time + 0.5; } - self.predator.digestion_step = time; + self.predator.digestion_step = time + steptime; } if(self.health <= 0) @@ -235,11 +253,13 @@ void Vore_Digest() .float teamheal_step; void Vore_Teamheal() { + // apply teamheal + if(cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable")) - if(time > self.teamheal_step + steptime) + if(time > self.teamheal_step) { self.health += cvar("g_balance_vore_teamheal"); - self.teamheal_step = time; + self.teamheal_step = time + steptime; } } @@ -247,8 +267,6 @@ void Vore_Teamheal() void Vore_StomachKick() { // allows prey to kick the predator's stomach and do some damage or attempt to escape - if(self.predator.classname != "player") - return; if(time > self.stomachkick_delay) { @@ -257,7 +275,7 @@ void Vore_StomachKick() Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, '0 0 0'); sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM); - if(cvar("g_balance_vore_kick_escapeprobability") >= random()) + if(random() < cvar("g_balance_vore_kick_escapeprobability")) Vore_Regurgitate(self); self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay"); @@ -268,35 +286,25 @@ void Vore_StomachLeave() { // allows players to get out of their predator at will in some circumstances, such as team mates - if(Vore_PreyCanLeave()) + if(Vore_CanLeave()) Vore_Regurgitate(self); - else if(time > self.complain_swallow) + else if(time > self.complain_vore) { play2(self, "weapons/unavailable.wav"); sprint(self, strcat("You cannot get out of ", self.predator.netname, "\n")); - self.complain_swallow = time + complain_delay; - } -} - -.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; + self.complain_vore = time + complain_delay_time; } } void Vore() { - // if we are free, show our stomach load on the HUD. Otherwise, show the predator's + // main vore code, this is where it all happens + + // set all vore related stats if(self.predator.classname == "player") { - self.stat_stomachload = self.predator.stomach_load; - self.stat_digesting = self.predator.digesting; + self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board + self.stat_digesting = self.predator.digesting; // necessary for the stomach board self.stat_eaten = num_for_edict(self.predator); } else @@ -305,9 +313,10 @@ void Vore() self.stat_digesting = self.digesting; self.stat_eaten = 0; } + self.stat_canleave = Vore_CanLeave(); // skip the vore system under some circumstances - if(time < game_starttime || (time < warmup && !inWarmupStage)) + if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins { Vore_Disconnect(); return; @@ -324,49 +333,49 @@ void Vore() entity prey; prey = Swallow_distance_check(); - // attempt to swallow our new prey if there's any in range + // attempt to swallow our new prey if we pressed the attack button, and there's any in range if(self.BUTTON_ATCK && !self.BUTTON_REGURGITATE && self.swallow_delay < time) if(Swallow_condition_check(prey)) Vore_Swallow(prey); - // start / stop digestion on command, if the player has someone in their stomach + // toggle digestion, if the player has someone in their stomach if(self.BUTTON_DIGEST) { if(self.stomach_load) { - if(time > self.digest_button_delay) + if(time > self.digest_button_delay_time) { self.digesting = !self.digesting; - self.digest_button_delay = time + button_delay; + self.digest_button_delay_time = time + button_delay_time; } } - else if(time > self.complain_swallow) + else if(time > self.complain_vore) { play2(self, "weapons/unavailable.wav"); sprint(self, "There is nothing to digest\n"); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } } if(!self.stomach_load) self.digesting = FALSE; - // release players from this player's stomach on command + // predator wishes to regurgitate his prey if(self.BUTTON_REGURGITATE) { if(self.stomach_load) { - if(time > self.regurgitate_button_delay) + if(time > self.regurgitate_button_delay_time) { self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay"); PlayerSound(self, playersound_regurgitate_prepare, CHAN_VOICE, VOICETYPE_PLAYERSOUND); - self.regurgitate_button_delay = time + button_delay; + self.regurgitate_button_delay_time = time + button_delay_time; } } - else if(time > self.complain_swallow) + else if(time > self.complain_vore) { play2(self, "weapons/unavailable.wav"); sprint(self, "There is nothing to regurgitate\n"); - self.complain_swallow = time + complain_delay; + self.complain_vore = time + complain_delay_time; } } @@ -388,7 +397,7 @@ void Vore() target_predator = self.predator.predator; Vore_Regurgitate(self); - if(random() < cvar("g_vore_stealprey")) + if(random() < cvar("g_vore_stealprey")) // steal our prey's prey if this probability returns true if not(teams_matter && self.predator.team == target_predator.team) // don't steal a team mate's prey if(Swallow_condition_check(self)) { @@ -401,25 +410,25 @@ void Vore() else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) Vore_Regurgitate(self); - // apply delayed regurgitating + // 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_swallow = time + complain_delay; + self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach Vore_Regurgitate(self); } + // execute digesting and team healing if(self.predator.digesting == TRUE) Vore_Digest(); if(teams_matter && self.team == self.predator.team) Vore_Teamheal(); + // execute prey commands if(self.BUTTON_ATCK) Vore_StomachKick(); if(self.BUTTON_JUMP) Vore_StomachLeave(); - self.stat_canleave = Vore_PreyCanLeave(); - Vore_CameraEffect_Apply(); } \ No newline at end of file