]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Remove consumable items when the player disconnects, respawns, or gets eaten
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 12:16:39 +0000 (14:16 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 12:16:39 +0000 (14:16 +0200)
data/qcsrc/server/cl_client.qc
data/qcsrc/server/t_items.qc

index aae54ae1c2e6ca90f521a3e310b8aad95c67e00e..9b26c49053f7410aff10121ce544780ff009365c 100644 (file)
@@ -803,6 +803,8 @@ Called when a client spawns in the server
 //void() ctf_playerchanged;\r
 void PutClientInServer (void)\r
 {\r
+       entity e;\r
+\r
        if(clienttype(self) == CLIENTTYPE_BOT)\r
        {\r
                self.classname = "player";\r
@@ -849,6 +851,16 @@ void PutClientInServer (void)
 \r
                Vore_Disconnect();\r
                self.swallow_progress_pred = self.swallow_progress_prey = 0;\r
+               for(e = world; (e = find(e, classname, "consumable")); )\r
+               {\r
+                       // remove consumable items when we respawn\r
+                       if(e.predator == self)\r
+                       {\r
+                               e.nextthink = 0;\r
+                               remove(e);\r
+                               e = world;\r
+                       }\r
+               }\r
 \r
                self.classname = "player";\r
                self.wasplayer = TRUE;\r
@@ -1018,7 +1030,6 @@ void PutClientInServer (void)
             weapon_action(j, WR_RESETPLAYER);\r
 \r
                        // all weapons must be fully loaded when we spawn\r
-                       entity e;\r
                        e = get_weaponinfo(j);\r
                        if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars\r
                                self.(weapon_load[j]) = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));\r
index 8932a2e13ee170816f07dbf32b98d7b6e7dbb35f..75bac5bfab3bfb33e40a639363f42b358c75012f 100644 (file)
@@ -230,6 +230,19 @@ void Item_Consumable_Think()
                return;\r
        }\r
 \r
+       if(self.predator.classname != "player")\r
+       {\r
+               // no longer a player, remove consumable items\r
+               Item_Consumable_Remove();\r
+               return;\r
+       }\r
+       if(self.predator.stat_eaten)\r
+       {\r
+               // prey can't hold consumable items\r
+               Item_Consumable_Remove();\r
+               return;\r
+       }\r
+\r
        dprint("!!!!!!!!\n");\r
        self.nextthink = time;\r
 }\r