From: MirceaKitsune Date: Mon, 19 Mar 2012 15:00:16 +0000 (+0200) Subject: First attempt to make health possible to swallow slowly. Incomplete and still buggy... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9bd4db11a9b92282b23c2d68cff53bf15857ff6b;p=voretournament%2Fvoretournament.git First attempt to make health possible to swallow slowly. Incomplete and still buggy, but working for the most part. --- diff --git a/data/balanceVT.cfg b/data/balanceVT.cfg index ab4944ac..ba23e421 100644 --- a/data/balanceVT.cfg +++ b/data/balanceVT.cfg @@ -62,6 +62,9 @@ set g_pickup_respawntimejitter_long 0 set g_pickup_respawntimejitter_powerup 10 set g_pickup_respawntimejitter_weapon 0 set g_pickup_respawntimejitter_ammo 0 + +set g_balance_healthsmall_swallow_speed_fill 2 "how long it takes to swallow a player, 0 is instant" +set g_balance_vore_swallow_speed_decrease 0.5 "how fast the swallow progress decreases, when the predator is no longer swallowing" // }}} // {{{ regen/rot diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 9faf0882..8053a4db 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -414,6 +414,37 @@ void Item_DroppedConsumable_Spawn(entity e) SUB_SetFade(item, time + 20, 1); } +float Item_Swallow(entity item, entity player) +{ + float pickedup; + pickedup = FALSE; + + item.swallow_progress_prey = min(item.swallow_progress_prey + 0.02, 1); + if(item.swallow_progress_prey < 1) + return FALSE; // item not eaten yet + + if(item.dmg && cvar("g_vore")) // consumable item, only if the vore system is enabled + { + 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); + } + } + else if (player.health < item.max_health) + { + pickedup = TRUE; + item.swallow_progress_prey = 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; +} + float Item_GiveTo(entity item, entity player) { float _switchweapon; @@ -496,23 +527,7 @@ float Item_GiveTo(entity item, entity player) } if (item.health) - { - if(item.dmg && cvar("g_vore")) // consumable item, only if the vore system is enabled - { - 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_Consumable_Spawn(self, player); - } - } - else if (player.health < item.max_health) - { - pickedup = TRUE; - player.health = min(player.health + item.health, item.max_health); - player.pauserothealth_finished = max(player.pauserothealth_finished, time + cvar("g_balance_pause_health_rot")); - } - } + pickedup = Item_Swallow(item, player); if (item.armorvalue) if (player.armorvalue < item.max_armorvalue) { @@ -538,6 +553,17 @@ float Item_GiveTo(entity item, entity player) return 1; } +void Item_Think() +{ + self.nextthink = time; + + if(!self.swallow_progress_prey) + return; + + self.swallow_progress_prey = max(0, self.swallow_progress_prey - 0.01); + self.alpha = 1 / self.swallow_progress_prey; +} + void Item_Touch (void) { entity e, head; @@ -722,7 +748,6 @@ float commodity_pickupevalfunc(entity player, entity item) return item.bot_pickupbasevalue * c; }; - .float is_item; void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue) { @@ -875,6 +900,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.weapons = weaponid; self.flags = FL_ITEM | itemflags; self.touch = Item_Touch; + self.think = Item_Think; + self.nextthink = time; setmodel (self, self.mdl); // precision set below self.effects |= EF_LOWPRECISION; if((itemflags & FL_POWERUP) || self.health || self.armorvalue) diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index e64eaab6..cae9440b 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -762,17 +762,9 @@ void Vore() if(cvar("g_balance_vore_swallow_speed_decrease")) { if(self.swallow_progress_pred) - { - self.swallow_progress_pred -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; - if(self.swallow_progress_pred < 0) - self.swallow_progress_pred = 0; - } + self.swallow_progress_pred = max(0, self.swallow_progress_pred - cvar("g_balance_vore_swallow_speed_decrease") * frametime); if(self.swallow_progress_prey) - { - self.swallow_progress_prey -= cvar("g_balance_vore_swallow_speed_decrease") * frametime; - if(self.swallow_progress_prey < 0) - self.swallow_progress_prey = 0; - } + self.swallow_progress_prey = max(0, self.swallow_progress_prey - cvar("g_balance_vore_swallow_speed_decrease") * frametime); } // set the predator's stomach load and capacity diff --git a/docs/TODO.txt b/docs/TODO.txt index 42f58589..37cc1d42 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -104,9 +104,15 @@ - +0.8: Some sort of bullet time feature in single player, by setting the slowmo cvar +- 0.8: Don't apply weight in vore.qc, since it's not a more general component + - 0.8 BUG: Stomach load appeared 101 while my health was 100 -- 0.8: Give weapons a weight, which affects the player based on size +- 0.8: Give weapons a weight, which affects the player based on size? + +- 0.8: How do teamed items work? + +- 0.8: Does item alpha break any game modes, now that slow swallowing items are implemented? - 0.8: Don't allow macros in the tutorial map (use health rot), since their weight makes it impossible to pass some parts