]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Fix bug with fake prey being removed from predator
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index 1df5d2f42b1ed3a8b83b791e01cd4316b6d1eb61..780a28c153e968b6c5e8ddc1d639588f78e399e0 100644 (file)
@@ -298,22 +298,24 @@ void Vore_DeadPrey_Detach(entity e)
                return;\r
 \r
        e.fakepredator = world;\r
+       e.fakeprey = FALSE;\r
        e.aiment = world;\r
-\r
-       if(!e.deadflag)\r
-               e.fakeprey = FALSE;\r
+       e.movetype = MOVETYPE_TOSS;\r
 }\r
 \r
-void Vore_PreyRelease(entity e)\r
+void Vore_PreyRelease(entity e, float pred_disconnect)\r
 {\r
        // if the keepdeadprey feature is on, don't spit a dead prey's carcass out\r
        if(e.health <= 0 && cvar("g_vore_keepdeadprey"))\r
        {\r
-               Vore_DeadPrey_Configure(e);\r
-\r
                // if keepdeadprey is enabled and the predator disconnected, detach the dead prey\r
-               if(e.fakepredator.classname != "player")\r
-                       Vore_DeadPrey_Detach(e);\r
+               if(pred_disconnect)\r
+               {\r
+                       if(e.fakeprey)\r
+                               Vore_DeadPrey_Detach(e);\r
+               }\r
+               else\r
+                       Vore_DeadPrey_Configure(e);\r
        }\r
        else\r
                Vore_Regurgitate(e);\r
@@ -325,19 +327,16 @@ void Vore_Disconnect()
 \r
        // prey disconnects or goes spectating while inside someone's belly\r
        if(self.predator.classname == "player")\r
-               Vore_PreyRelease(self);\r
+               Vore_PreyRelease(self, TRUE);\r
 \r
        // pred disconnects or goes spectating with players in their belly\r
-       else if(self.stomach_load > 0)\r
+       entity head;\r
+       FOR_EACH_PLAYER(head)\r
        {\r
-               entity head;\r
-               FOR_EACH_PLAYER(head)\r
-               {\r
-                       if(head.predator == self)\r
-                               Vore_PreyRelease(head);\r
-               }\r
-               Vore_GurgleSound(); // stop the gurgling sound\r
+               if(head.predator == self || head.fakepredator == self)\r
+                       Vore_PreyRelease(head, TRUE);\r
        }\r
+       Vore_GurgleSound(); // stop the gurgling sound\r
 \r
        self.stomach_load = self.gravity = 0; // prevents a bug\r
 }\r
@@ -617,7 +616,7 @@ void Vore()
 \r
        if(self.deadflag)\r
        {\r
-               Vore_PreyRelease(self);\r
+               Vore_PreyRelease(self, FALSE);\r
                return;\r
        }\r
 \r