]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Get swallowable items closer to working. They are almost ready, but need cvars to...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 19 Mar 2012 15:09:11 +0000 (17:09 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 19 Mar 2012 15:09:11 +0000 (17:09 +0200)
data/qcsrc/server/t_items.qc

index 8053a4dbb879a0ae3967332d1975b08bcc5966b0..6b04779f1fa77ac62cdabc8fc8180f79b2d7abbb 100644 (file)
@@ -416,32 +416,38 @@ void Item_DroppedConsumable_Spawn(entity e)
 \r
 float Item_Swallow(entity item, entity player)\r
 {\r
-       float pickedup;\r
+       float pickedup, usage;\r
        pickedup = FALSE;\r
+       if(item.dmg && cvar("g_vore"))\r
+       {\r
+               if(player.stomach_load + item.dmg <= player.stomach_maxload)\r
+               if not(!cvar("g_balance_health_consumable_alwayspickup") && player.health >= item.max_health)\r
+                       usage = 2; // consumable item, only if the vore system is enabled\r
+       }\r
+       else if (player.health < item.max_health)\r
+               usage = 1; // normal item\r
+       if(!usage)\r
+               return FALSE;\r
 \r
        item.swallow_progress_prey = min(item.swallow_progress_prey + 0.02, 1);\r
+       player.swallow_progress_pred = item.swallow_progress_prey;\r
        if(item.swallow_progress_prey < 1)\r
-               return FALSE; // item not eaten yet\r
+               return FALSE; // swallow progress not full yet\r
 \r
-       if(item.dmg && cvar("g_vore")) // consumable item, only if the vore system is enabled\r
+       if(usage > 1)\r
        {\r
-               if(player.stomach_load + item.dmg <= player.stomach_maxload)\r
-               if not(!cvar("g_balance_health_consumable_alwayspickup") && player.health >= item.max_health)\r
-               {\r
-                       pickedup = TRUE;\r
-                       item.swallow_progress_prey = 0;\r
-                       Item_Consumable_Spawn(item, player);\r
-               }\r
+               pickedup = TRUE;\r
+               item.swallow_progress_prey = player.swallow_progress_pred = 0;\r
+               Item_Consumable_Spawn(item, player);\r
        }\r
-       else if (player.health < item.max_health)\r
+       else\r
        {\r
                pickedup = TRUE;\r
-               item.swallow_progress_prey = 0;\r
+               item.swallow_progress_prey = player.swallow_progress_pred = 0;\r
                player.health = min(player.health + item.health, item.max_health);\r
                player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));\r
        }\r
 \r
-       player.swallow_progress_pred = item.swallow_progress_prey;\r
        return pickedup;\r
 }\r
 \r