]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Small cleanups and comment changes
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index f30e29a1f91fb31ce51a73e1410fc351da28e039..c9adc930e8e5644e5d8e7233416aab195c5b504d 100644 (file)
@@ -231,24 +231,25 @@ void Vore_DeadPrey_Configure(entity e)
 {\r
        // ran when the fulldigest feature is enabled and prey stays inside the stomach after dying\r
 \r
-       if(e.fakepredator.classname == "player" || e.predator.classname != "player")\r
+       if(e.fakepredator.classname == "player" || e.predator.classname != "player") // already configured\r
                return;\r
 \r
-       // this entity is pretty much like e.predator but for dead prey, to avoid some conflicts\r
+       // this entity is like e.predator but for dead prey, to avoid 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
+       // first release the prey from the predator, as dead prey needs to be attached differently\r
+       // the predator's stomach load is also decreased, as dead prey doesn't count 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
+       // now put our dead prey inside the predator's stomach, but only as an effect\r
        e.movetype = MOVETYPE_FOLLOW;\r
        e.takedamage = DAMAGE_NO;\r
        e.solid = SOLID_NOT;\r
        e.aiment = e.fakepredator;\r
-       // completely hide the dead body\r
+\r
+       // completely remove the dead body\r
        e.alpha = -1;\r
        setmodel(e, "");\r
 }\r
@@ -256,16 +257,26 @@ void Vore_DeadPrey_Configure(entity e)
 void Vore_DeadPrey_Detach(entity e)\r
 {\r
        // ran when dead prey must be detached from the stomach (eg: they are respawning)\r
+       // should only execute after Vore_DeadPrey_Configure has ran first\r
+\r
+       if not(cvar("g_vore_fulldigest"))\r
+               return;\r
 \r
        e.fakepredator = world;\r
        e.aiment = world;\r
 }\r
 \r
-void Vore_ChoosePreyRelease(entity e)\r
+void Vore_PreyRelease(entity e)\r
 {\r
-       // if the fulldigest feature is on, we don't spit a dead prey's carcass out\r
+       // if the fulldigest feature is on, 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 fulldigest is enabled and the predator is dead or disconnected, detach the dead prey from him\r
+               if(self.fakepredator.classname != "player" || self.fakepredator.deadflag != DEAD_NO)\r
+                       Vore_DeadPrey_Detach(self);\r
+       }\r
        else\r
                Vore_Regurgitate(e);\r
 }\r
@@ -276,7 +287,7 @@ void Vore_Disconnect()
 \r
        // prey disconnects or goes spectating while inside someone's belly\r
        if(self.predator.classname == "player")\r
-               Vore_ChoosePreyRelease(self);\r
+               Vore_PreyRelease(self);\r
 \r
        // pred disconnects or goes spectating with players in their belly\r
        else if(self.stomach_load > 0)\r
@@ -285,7 +296,7 @@ void Vore_Disconnect()
                FOR_EACH_PLAYER(head)\r
                {\r
                        if(head.predator == self)\r
-                               Vore_ChoosePreyRelease(head);\r
+                               Vore_PreyRelease(head);\r
                }\r
                Vore_Gurglesound(); // stop the gurgling sound\r
        }\r
@@ -502,12 +513,7 @@ void Vore()
 \r
        if(self.deadflag)\r
        {\r
-               Vore_ChoosePreyRelease(self);\r
-\r
-               // if the predator's dead, we detach the dead prey from him\r
-               if(self.fakepredator.classname != "player" || self.fakepredator.deadflag != DEAD_NO)\r
-                       Vore_DeadPrey_Detach(self);\r
-\r
+               Vore_PreyRelease(self);\r
                return;\r
        }\r
 \r