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
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
\r
float Item_Swallow(entity item, entity player)\r
{\r
- float pickedup;\r
- pickedup = FALSE;\r
-\r
- item.swallow_progress_prey = min(item.swallow_progress_prey + 0.02, 1);\r
- if(item.swallow_progress_prey < 1)\r
- return FALSE; // item not eaten yet\r
-\r
- if(item.dmg && cvar("g_vore")) // consumable item, only if the vore system is enabled\r
+ float pickedup, usage;\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
- {\r
- pickedup = TRUE;\r
- item.swallow_progress_prey = 0;\r
- Item_Consumable_Spawn(item, player);\r
- }\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 = item.swallow_progress_prey + cvar("g_balance_vore_swallow_speed_item_fill") * (player.health / item.health);\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
+\r
+ if(usage > 1)\r
+ {\r
+ pickedup = TRUE;\r
+ item.swallow_progress_prey = player.swallow_progress_pred = 0;\r
+ Item_Consumable_Spawn(item, player);\r
+ }\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
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