]> git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/t_items.qc
Separate and fix some cvars
[voretournament/voretournament.git] / data / qcsrc / server / t_items.qc
index 9b65c50c2f5266c8ff58e177cf50ba1ec2a85351..4f24cec237cc351c93408fa4bb0dd52916a62fd9 100644 (file)
@@ -428,10 +428,14 @@ float Item_Swallow(entity item, entity player)
        if(!usage)\r
                return FALSE;\r
 \r
-       item.swallow_progress_prey = item.swallow_progress_prey + cvar("g_balance_vore_swallow_speed_item_fill") * (player.health / item.health);\r
+       // since map items don't have a scale, calculate one based on player size center and the item's health, in order to determine swallowing speed\r
+       float scalediff;\r
+       scalediff = pow((item.health / cvar("g_healthsize_center")) / player.scale, cvar("g_balance_vore_swallow_speed_fill_scalediff_item"));\r
+\r
+       item.swallow_progress_prey += cvar("g_balance_vore_swallow_speed_fill_item") / scalediff;\r
        player.swallow_progress_pred = item.swallow_progress_prey;\r
-       if(item.swallow_progress_prey < 1)\r
-               return FALSE; // swallow progress not full yet\r
+       if(item.swallow_progress_prey < 1 && cvar("g_balance_vore_swallow_speed_fill_item"))\r
+               return FALSE; // swallow progress not full yet, or slow swallowing of items is disabled\r
 \r
        if(usage > 1)\r
        {\r