From: MirceaKitsune Date: Sun, 27 Feb 2011 15:09:49 +0000 (+0200) Subject: Implement full digest feature. When enabled, the pred doesn't spit the prey's dead... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=189d1f9770ad26d090c52d8d5512f31315698469;p=voretournament%2Fvoretournament.git Implement full digest feature. When enabled, the pred doesn't spit the prey's dead body out, and the prey can see the stomach until respawning. Still buggy and not fully ready. --- diff --git a/data/defaultVoretournament.cfg b/data/defaultVoretournament.cfg index b52f2604..08d154df 100644 --- a/data/defaultVoretournament.cfg +++ b/data/defaultVoretournament.cfg @@ -1529,6 +1529,7 @@ set g_vore_soundocclusion 0.25 "directional player sounds are cut to this amount set g_vore_regurgitatecolor_release "0.4 0.6 0.1" "the color players will have when regurgitated alive" set g_vore_regurgitatecolor_release_fade 0.01 "how quickly the regurgitation color washes off players once they leave the stomach" set g_vore_regurgitatecolor_digest "0.15 0.25 0" "the color players will have when digested" +set g_vore_fulldigest 1 "If enabled, prey remains inside the stomach after dying from digestion, else the predator throws up their dead body" // part of an ugly hack for the menu audio sliders to work with the cutsound feature set menu_volume $volume diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index ab1658f8..3ec0cddf 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -516,13 +516,13 @@ float Client_customizeentityforclient() if(other.cvar_chase_active > 0 || other.classname == "observer") // the classname check prevents a bug { Client_setmodel(setmodel_state()); - if not(self.predator.classname == "player") + if not(self.predator.classname == "player" || self.fakepredator.classname == "player") self.alpha = default_player_alpha; return TRUE; } if(other.spectatee_status) other = other.enemy; // also do this for the player we are spectating - if(other.predator == self) + if(other.predator == self || other.fakepredator == self) { applymodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_stomach.md3"); // 4 is the extension length Client_setmodel(applymodel); @@ -530,7 +530,7 @@ float Client_customizeentityforclient() return TRUE; } Client_setmodel(setmodel_state()); - if not(self.predator.classname == "player") + if not(self.predator.classname == "player" || self.fakepredator.classname == "player") self.alpha = default_player_alpha; return TRUE; } @@ -828,6 +828,8 @@ void PutClientInServer (void) RemoveGrabber(self); // Wazat's Grabber + Vore_DeadPrey_Detach(self); + self.classname = "player"; self.wasplayer = TRUE; self.iscreature = TRUE; diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index ee876623..f175727d 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -66,6 +66,7 @@ float maxclients; // Vore functions .entity predator; +.entity fakepredator; .float digesting; .float stomach_load; .float weapon_delay; diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 1b76d469..70bdd863 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -227,13 +227,68 @@ void Vore_Regurgitate(entity e) e.predator = world; } +void Vore_DeadPrey_Configure(entity e) +{ + // ran when the fulldigest feature is enabled and prey stays inside the stomach after dying + + if(e.fakepredator.classname == "player") + return; + + // this entity is pretty much like e.predator but for dead prey, to avoid some conflicts + e.fakepredator = e.predator; + + // first release the prey from the predator, as dead prey needs to be attached to predators differently + // the predator's stomach load is also decreased, as our dead prey doesn't count as actual prey any more + e.predator.stomach_load -= 1; + Vore_Weight_apply(e.predator); + e.predator = world; + + // now, keep our dead prey inside the predator's stomach + e.movetype = MOVETYPE_FOLLOW; + e.aiment = e.fakepredator; + e.alpha = -1; +} + +void Vore_DeadPrey_Detach(entity e) +{ + // ran when dead prey must be detached from the stomach (eg: they are respawning) + + if(e.fakepredator.classname != "player") + return; + + e.movetype = e.vore_oldmovetype; + e.view_ofs_z = PL_VIEW_OFS_z; + e.alpha = default_player_alpha; + + // if we disconnect dead prey from the predator, gib it's body + if(e.health <= 0) + e.health = -1000; + + e.fakepredator = world; +} + +void Vore_ChoosePreyRelease(entity e) +{ + // if the fulldigest feature is on, we don't spit a dead prey's carcass out + if(e.health <= 0 && cvar("g_vore_fulldigest")) + { + Vore_DeadPrey_Configure(e); + + // if the predator's dead, we detach the dead prey from him + if(e.fakepredator.deadflag != DEAD_NO) + Vore_DeadPrey_Detach(e); + } + else + Vore_Regurgitate(e); +} + void Vore_Disconnect() { // 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 if(self.predator.classname == "player") - Vore_Regurgitate(self); + Vore_ChoosePreyRelease(self); // pred disconnects or goes spectating with players in their belly else if(self.stomach_load > 0) @@ -242,7 +297,7 @@ void Vore_Disconnect() FOR_EACH_PLAYER(head) { if(head.predator == self) - Vore_Regurgitate(head); + Vore_ChoosePreyRelease(head); } Vore_Gurglesound(); // stop the gurgling sound } @@ -457,10 +512,14 @@ void Vore() // Code that addresses the prey: // -------------------------------- + if(self.deadflag) + { + Vore_ChoosePreyRelease(self); + return; + } if(self.predator.classname != "player") return; - - if(self.deadflag || self.predator.deadflag) + if(self.predator.deadflag) Vore_Regurgitate(self); else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap")) Vore_Regurgitate(self); diff --git a/data/qcsrc/server/vore.qh b/data/qcsrc/server/vore.qh index 4b99129f..96eb5ed5 100644 --- a/data/qcsrc/server/vore.qh +++ b/data/qcsrc/server/vore.qh @@ -1,5 +1,6 @@ void Vore(); void Vore_Disconnect(); +void Vore_DeadPrey_Detach(entity e); entity Swallow_player_check(); float Swallow_condition_check(entity prey); \ No newline at end of file