]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
First attempt to make health possible to swallow slowly. Incomplete and still buggy...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 19 Mar 2012 15:00:16 +0000 (17:00 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 19 Mar 2012 15:00:16 +0000 (17:00 +0200)
data/balanceVT.cfg
data/qcsrc/server/t_items.qc
data/qcsrc/server/vore.qc
docs/TODO.txt

index ab4944ac984c9e4e4118f43e76ce0f3fc4965e82..ba23e421e110e30d2484fd7c50a27f5584814154 100644 (file)
@@ -62,6 +62,9 @@ set g_pickup_respawntimejitter_long 0
 set g_pickup_respawntimejitter_powerup 10\r
 set g_pickup_respawntimejitter_weapon 0\r
 set g_pickup_respawntimejitter_ammo 0\r
+\r
+set g_balance_healthsmall_swallow_speed_fill 2 "how long it takes to swallow a player, 0 is instant"\r
+set g_balance_vore_swallow_speed_decrease 0.5 "how fast the swallow progress decreases, when the predator is no longer swallowing"\r
 // }}}\r
 \r
 // {{{ regen/rot\r
index 9faf08821fb325c3b9a5da7e5eb278fbab0e104f..8053a4dbb879a0ae3967332d1975b08bcc5966b0 100644 (file)
@@ -414,6 +414,37 @@ void Item_DroppedConsumable_Spawn(entity e)
        SUB_SetFade(item, time + 20, 1);\r
 }\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
+       {\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
+       }\r
+       else if (player.health < item.max_health)\r
+       {\r
+               pickedup = TRUE;\r
+               item.swallow_progress_prey = 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
 float Item_GiveTo(entity item, entity player)\r
 {\r
        float _switchweapon;\r
@@ -496,23 +527,7 @@ float Item_GiveTo(entity item, entity player)
                }\r
 \r
                if (item.health)\r
-               {\r
-                       if(item.dmg && cvar("g_vore")) // consumable item, only if the vore system is enabled\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_Consumable_Spawn(self, player);\r
-                               }\r
-                       }\r
-                       else if (player.health < item.max_health)\r
-                       {\r
-                               pickedup = TRUE;\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
+                       pickedup = Item_Swallow(item, player);\r
                if (item.armorvalue)\r
                if (player.armorvalue < item.max_armorvalue)\r
                {\r
@@ -538,6 +553,17 @@ float Item_GiveTo(entity item, entity player)
        return 1;\r
 }\r
 \r
+void Item_Think()\r
+{\r
+       self.nextthink = time;\r
+\r
+       if(!self.swallow_progress_prey)\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
+}\r
+\r
 void Item_Touch (void)\r
 {\r
        entity e, head;\r
@@ -722,7 +748,6 @@ float commodity_pickupevalfunc(entity player, entity item)
        return item.bot_pickupbasevalue * c;\r
 };\r
 \r
-\r
 .float is_item;\r
 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)\r
 {\r
@@ -875,6 +900,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        self.weapons = weaponid;\r
        self.flags = FL_ITEM | itemflags;\r
        self.touch = Item_Touch;\r
+       self.think = Item_Think;\r
+       self.nextthink = time;\r
        setmodel (self, self.mdl); // precision set below\r
        self.effects |= EF_LOWPRECISION;\r
        if((itemflags & FL_POWERUP) || self.health || self.armorvalue)\r
index e64eaab61b59fcf4e7fcaeb06e0145c73092f9bc..cae9440ba74c690246e3c754e3665e8df43be025 100644 (file)
@@ -762,17 +762,9 @@ void Vore()
        if(cvar("g_balance_vore_swallow_speed_decrease"))\r
        {\r
                if(self.swallow_progress_pred)\r
-               {\r
-                       self.swallow_progress_pred -= cvar("g_balance_vore_swallow_speed_decrease") * frametime;\r
-                       if(self.swallow_progress_pred < 0)\r
-                               self.swallow_progress_pred = 0;\r
-               }\r
+                       self.swallow_progress_pred = max(0, self.swallow_progress_pred - cvar("g_balance_vore_swallow_speed_decrease") * frametime);\r
                if(self.swallow_progress_prey)\r
-               {\r
-                       self.swallow_progress_prey -= cvar("g_balance_vore_swallow_speed_decrease") * frametime;\r
-                       if(self.swallow_progress_prey < 0)\r
-                               self.swallow_progress_prey = 0;\r
-               }\r
+                       self.swallow_progress_prey = max(0, self.swallow_progress_prey - cvar("g_balance_vore_swallow_speed_decrease") * frametime);\r
        }\r
 \r
        // set the predator's stomach load and capacity\r
index 42f585896e85c3021e615d42ac2a2f2c23a3dc1e..37cc1d42f54eac911e5278f96899fdee71da5635 100644 (file)
 \r
 - +0.8: Some sort of bullet time feature in single player, by setting the slowmo cvar\r
 \r
+- 0.8: Don't apply weight in vore.qc, since it's not a more general component\r
+\r
 - 0.8 BUG: Stomach load appeared 101 while my health was 100\r
 \r
-- 0.8: Give weapons a weight, which affects the player based on size\r
+- 0.8: Give weapons a weight, which affects the player based on size?\r
+\r
+- 0.8: How do teamed items work?\r
+\r
+- 0.8: Does item alpha break any game modes, now that slow swallowing items are implemented?\r
 \r
 - 0.8: Don't allow macros in the tutorial map (use health rot), since their weight makes it impossible to pass some parts\r
 \r