]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Implement full digest feature. When enabled, the pred doesn't spit the prey's dead...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 27 Feb 2011 15:09:49 +0000 (17:09 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 27 Feb 2011 15:09:49 +0000 (17:09 +0200)
data/defaultVoretournament.cfg
data/qcsrc/server/cl_client.qc
data/qcsrc/server/defs.qh
data/qcsrc/server/vore.qc
data/qcsrc/server/vore.qh

index b52f26043c35b14c5194eeba728f0eb04dfd3d08..08d154df4dd975498040fb69b572cf9c8f5742e5 100644 (file)
@@ -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"\r
 set g_vore_regurgitatecolor_release_fade 0.01 "how quickly the regurgitation color washes off players once they leave the stomach"\r
 set g_vore_regurgitatecolor_digest "0.15 0.25 0" "the color players will have when digested"\r
+set g_vore_fulldigest 1 "If enabled, prey remains inside the stomach after dying from digestion, else the predator throws up their dead body"\r
 \r
 // part of an ugly hack for the menu audio sliders to work with the cutsound feature\r
 set menu_volume $volume\r
index ab1658f8980d7e81d8478e4d4dd1c167c369df18..3ec0cddf5c4e0b37283600a961c4d1c7e1e79deb 100644 (file)
@@ -516,13 +516,13 @@ float Client_customizeentityforclient()
        if(other.cvar_chase_active > 0 || other.classname == "observer") // the classname check prevents a bug\r
        {\r
                Client_setmodel(setmodel_state());\r
-               if not(self.predator.classname == "player")\r
+               if not(self.predator.classname == "player" || self.fakepredator.classname == "player")\r
                        self.alpha = default_player_alpha;\r
                return TRUE;\r
        }\r
        if(other.spectatee_status)\r
                other = other.enemy; // also do this for the player we are spectating\r
-       if(other.predator == self)\r
+       if(other.predator == self || other.fakepredator == self)\r
        {\r
                applymodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_stomach.md3"); // 4 is the extension length\r
                Client_setmodel(applymodel);\r
@@ -530,7 +530,7 @@ float Client_customizeentityforclient()
                return TRUE;\r
        }\r
        Client_setmodel(setmodel_state());\r
-       if not(self.predator.classname == "player")\r
+       if not(self.predator.classname == "player" || self.fakepredator.classname == "player")\r
                self.alpha = default_player_alpha;\r
        return TRUE;\r
 }\r
@@ -828,6 +828,8 @@ void PutClientInServer (void)
 \r
                RemoveGrabber(self); // Wazat's Grabber\r
 \r
+               Vore_DeadPrey_Detach(self);\r
+\r
                self.classname = "player";\r
                self.wasplayer = TRUE;\r
                self.iscreature = TRUE;\r
index ee8766234ed45cf60c07daf51a212e9c0d550f3a..f175727db163ccb53e90637a6198543f7086ec16 100644 (file)
@@ -66,6 +66,7 @@ float maxclients;
 // Vore functions\r
 \r
 .entity predator;\r
+.entity fakepredator;\r
 .float digesting;\r
 .float stomach_load;\r
 .float weapon_delay;\r
index 1b76d469f398e7b8cd2bcc745579a9e5fcacd414..70bdd8632066b3703a96bd2b349771be62dffd77 100644 (file)
@@ -227,13 +227,68 @@ void Vore_Regurgitate(entity e)
        e.predator = world;\r
 }\r
 \r
+void Vore_DeadPrey_Configure(entity e)\r
+{\r
+       // ran when the fulldigest feature is enabled and prey stays inside the stomach after dying\r
+\r
+       if(e.fakepredator.classname == "player")\r
+               return;\r
+\r
+       // this entity is pretty much like e.predator but for dead prey, to avoid some conflicts\r
+       e.fakepredator = e.predator;\r
+\r
+       // first release the prey from the predator, as dead prey needs to be attached to predators differently\r
+       // the predator's stomach load is also decreased, as our dead prey doesn't count as actual prey any more\r
+       e.predator.stomach_load -= 1;\r
+       Vore_Weight_apply(e.predator);\r
+       e.predator = world;\r
+\r
+       // now, keep our dead prey inside the predator's stomach\r
+       e.movetype = MOVETYPE_FOLLOW;\r
+       e.aiment = e.fakepredator;\r
+       e.alpha = -1;\r
+}\r
+\r
+void Vore_DeadPrey_Detach(entity e)\r
+{\r
+       // ran when dead prey must be detached from the stomach (eg: they are respawning)\r
+\r
+       if(e.fakepredator.classname != "player")\r
+               return;\r
+\r
+       e.movetype = e.vore_oldmovetype;\r
+       e.view_ofs_z = PL_VIEW_OFS_z;\r
+       e.alpha = default_player_alpha;\r
+\r
+       // if we disconnect dead prey from the predator, gib it's body\r
+       if(e.health <= 0)\r
+               e.health = -1000;\r
+\r
+       e.fakepredator = world;\r
+}\r
+\r
+void Vore_ChoosePreyRelease(entity e)\r
+{\r
+       // if the fulldigest feature is on, we don't spit a dead prey's carcass out\r
+       if(e.health <= 0 && cvar("g_vore_fulldigest"))\r
+       {\r
+               Vore_DeadPrey_Configure(e);\r
+\r
+               // if the predator's dead, we detach the dead prey from him\r
+               if(e.fakepredator.deadflag != DEAD_NO)\r
+                       Vore_DeadPrey_Detach(e);\r
+       }\r
+       else\r
+               Vore_Regurgitate(e);\r
+}\r
+\r
 void Vore_Disconnect()\r
 {\r
        // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances\r
 \r
        // prey disconnects or goes spectating while inside someone's belly\r
        if(self.predator.classname == "player")\r
-               Vore_Regurgitate(self);\r
+               Vore_ChoosePreyRelease(self);\r
 \r
        // pred disconnects or goes spectating with players in their belly\r
        else if(self.stomach_load > 0)\r
@@ -242,7 +297,7 @@ void Vore_Disconnect()
                FOR_EACH_PLAYER(head)\r
                {\r
                        if(head.predator == self)\r
-                               Vore_Regurgitate(head);\r
+                               Vore_ChoosePreyRelease(head);\r
                }\r
                Vore_Gurglesound(); // stop the gurgling sound\r
        }\r
@@ -457,10 +512,14 @@ void Vore()
 // Code that addresses the prey:\r
 // --------------------------------\r
 \r
+       if(self.deadflag)\r
+       {\r
+               Vore_ChoosePreyRelease(self);\r
+               return;\r
+       }\r
        if(self.predator.classname != "player")\r
                return;\r
-\r
-       if(self.deadflag || self.predator.deadflag)\r
+       if(self.predator.deadflag)\r
                Vore_Regurgitate(self);\r
        else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
                Vore_Regurgitate(self);\r
index 4b99129f69bb444270d76a4135d0b724946005a0..96eb5ed5ff71b31727b8a671d9867f8d2fefe297 100644 (file)
@@ -1,5 +1,6 @@
 void Vore();\r
 void Vore_Disconnect();\r
+void Vore_DeadPrey_Detach(entity e);\r
 \r
 entity Swallow_player_check();\r
 float Swallow_condition_check(entity prey);
\ No newline at end of file