Fix bug with fake prey being removed from predator
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 16 Apr 2011 16:59:31 +0000 (19:59 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 16 Apr 2011 16:59:31 +0000 (19:59 +0300)
data/qcsrc/server/cl_client.qc
data/qcsrc/server/vore.qc

index b9f654a..8e3754b 100644 (file)
@@ -829,6 +829,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
@@ -923,8 +925,6 @@ void PutClientInServer (void)
 \r
                SetCustomizer(self, Client_customizeentityforclient, Client_uncustomizeentityforclient);\r
 \r
-               Vore_DeadPrey_Detach(self);\r
-\r
                self.model = "";\r
                FixPlayermodel();\r
 \r
index 1df5d2f..780a28c 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