Fix item alpha, and get slow item swallowing to work with dropped consumables
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 19 Mar 2012 15:47:39 +0000 (17:47 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 19 Mar 2012 15:47:39 +0000 (17:47 +0200)
data/qcsrc/server/t_items.qc

index d7decef..9b65c50 100644 (file)
@@ -366,16 +366,15 @@ void Item_Consumable_Spawn(entity e, entity pl)
        pl.last_pickup = time;\r
 }\r
 \r
+float Item_Swallow(entity item, entity player);\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 not(other.stomach_load + self.dmg > other.stomach_maxload || other.stomach_load + self.initdmg > other.stomach_maxload)\r
-       if not(!cvar("g_balance_health_consumable_alwayspickup") && other.health >= self.max_health)\r
+       if(Item_Swallow(self, other))\r
        {\r
-               Item_Consumable_Spawn(self, other);\r
                remove(self);\r
                self = world;\r
        }\r
@@ -392,6 +391,7 @@ void Item_DroppedConsumable_Spawn(entity e)
        setmodel(item, e.model);\r
        item.health = e.health;\r
        item.inithealth = e.inithealth;\r
+       item.dmg = e.dmg;\r
        item.initdmg = e.initdmg;\r
        item.max_health = e.max_health;\r
        item.scale = e.scale;\r
@@ -417,7 +417,6 @@ void Item_DroppedConsumable_Spawn(entity e)
 float Item_Swallow(entity item, entity player)\r
 {\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
@@ -567,7 +566,7 @@ void Item_Think()
                return;\r
 \r
        self.swallow_progress_prey = max(0, self.swallow_progress_prey - 0.01);\r
-       self.alpha = 1 / self.swallow_progress_prey;\r
+       self.alpha = 1 - self.swallow_progress_prey;\r
 }\r
 \r
 void Item_Touch (void)\r