From: MirceaKitsune Date: Mon, 19 Mar 2012 15:09:11 +0000 (+0200) Subject: Get swallowable items closer to working. They are almost ready, but need cvars to... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5798d0093f0d083f69461a9603318254b006e54b;p=voretournament%2Fvoretournament.git Get swallowable items closer to working. They are almost ready, but need cvars to work --- diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 8053a4db..6b04779f 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -416,32 +416,38 @@ void Item_DroppedConsumable_Spawn(entity e) float Item_Swallow(entity item, entity player) { - float pickedup; + float pickedup, usage; pickedup = FALSE; + if(item.dmg && cvar("g_vore")) + { + if(player.stomach_load + item.dmg <= player.stomach_maxload) + if not(!cvar("g_balance_health_consumable_alwayspickup") && player.health >= item.max_health) + usage = 2; // consumable item, only if the vore system is enabled + } + else if (player.health < item.max_health) + usage = 1; // normal item + if(!usage) + return FALSE; item.swallow_progress_prey = min(item.swallow_progress_prey + 0.02, 1); + player.swallow_progress_pred = item.swallow_progress_prey; if(item.swallow_progress_prey < 1) - return FALSE; // item not eaten yet + return FALSE; // swallow progress not full yet - if(item.dmg && cvar("g_vore")) // consumable item, only if the vore system is enabled + if(usage > 1) { - if(player.stomach_load + item.dmg <= player.stomach_maxload) - if not(!cvar("g_balance_health_consumable_alwayspickup") && player.health >= item.max_health) - { - pickedup = TRUE; - item.swallow_progress_prey = 0; - Item_Consumable_Spawn(item, player); - } + pickedup = TRUE; + item.swallow_progress_prey = player.swallow_progress_pred = 0; + Item_Consumable_Spawn(item, player); } - else if (player.health < item.max_health) + else { pickedup = TRUE; - item.swallow_progress_prey = 0; + item.swallow_progress_prey = player.swallow_progress_pred = 0; player.health = min(player.health + item.health, item.max_health); player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot")); } - player.swallow_progress_pred = item.swallow_progress_prey; return pickedup; }