]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Allow dropped food to be picked back up by anyone. Yes, my game is going to be that...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 13:25:53 +0000 (15:25 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 13:25:53 +0000 (15:25 +0200)
data/qcsrc/server/t_items.qc

index 1d111d0177e7e64de6dd69e6d9a52c29f71061a5..a600ddd447cc948a8cb69cf2a1d130273a5aa60d 100644 (file)
@@ -321,6 +321,20 @@ void Item_Consumable_Spawn(entity e, entity pl)
        Vore_AutoDigest(pl);\r
 }\r
 \r
+void Item_DroppedConsumable_Touch()\r
+{\r
+       if(time < self.cnt)\r
+               return;\r
+\r
+       // give the consumable item to the player touching it\r
+       if(other.stomach_load + self.dmg <= other.stomach_maxload)\r
+       {\r
+               Item_Consumable_Spawn(self, other);\r
+               remove(self);\r
+               self = world;\r
+       }\r
+}\r
+\r
 void Item_DroppedConsumable_Spawn(entity e)\r
 {\r
        entity item;\r
@@ -342,6 +356,8 @@ void Item_DroppedConsumable_Spawn(entity e)
        item.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");\r
        e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce");\r
 \r
+       item.touch = Item_DroppedConsumable_Touch;\r
+       item.cnt = time + 1; // 1 second delay\r
        SUB_SetFade(item, time + 20, 1);\r
 }\r
 \r