]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/t_items.qc
Megahealth is not a powerup. Always enable it
[voretournament/voretournament.git] / data / qcsrc / server / t_items.qc
index b0c2eed7eeb090f1984d0525385bb23120f59f66..d936ddb7b3267986014254febe3568db8fd2fc21 100644 (file)
@@ -174,7 +174,7 @@ void Item_RespawnCountdown (void)
                                WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE);\r
                                if(self.waypointsprite_attached)\r
                                {\r
-                                       WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, rgb);\r
+                                       WaypointSprite_UpdateRadar(self.waypointsprite_attached, RADARICON_POWERUP, rgb);\r
                                        //WaypointSprite_UpdateMaxHealth(self.waypointsprite_attached, ITEM_RESPAWN_TICKS + 1);\r
                                        WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS);\r
                                }\r
@@ -219,8 +219,8 @@ void Item_ScheduleInitialRespawn(entity e)
        Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e));\r
 }\r
 \r
-.float inithealth;\r
-void Item_Consumable_Remove(entity e, float regurgitate);\r
+.float inithealth, initdmg;\r
+.float item_digestion_step;\r
 void Item_Consumable_Think()\r
 {\r
        if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare)\r
@@ -237,9 +237,36 @@ void Item_Consumable_Think()
                return;\r
        }\r
 \r
+       self.scale = self.health / self.inithealth; // scale matches the item's digestion progress\r
+       self.dmg = self.initdmg * self.scale;\r
+       if(self.health <= 0)\r
+       {\r
+               // this item is done\r
+               Item_Consumable_Remove(self, FALSE);\r
+               return;\r
+       }\r
+\r
        if(self.predator.digesting)\r
        {\r
-               self.scale = self.health / self.inithealth; // scale matches the item's digestion progress\r
+               if(time > self.item_digestion_step)\r
+               {\r
+                       // if distributed digestion is enabled, reduce digestion strength by the amount of prey in our stomach\r
+                       float damage, damage_offset;\r
+\r
+                       damage_offset = 1;\r
+                       if(cvar("g_balance_vore_digestion_distribute")) // apply distributed digestion damage\r
+                               damage_offset /= (1 - (self.predator.stomach_load / self.predator.stomach_maxload) * bound(0, cvar("g_balance_vore_digestion_distribute"), 1));\r
+                       damage = ceil(cvar("g_balance_vore_digestion_damage_item") / damage_offset);\r
+\r
+                       self.health -= damage;\r
+                       if(self.predator.health + damage <= self.max_health)\r
+                               self.predator.health += damage;\r
+                       else if(self.predator.health < self.max_health)\r
+                               self.predator.health = self.max_health;\r
+                       self.predator.pauserothealth_finished = max(self.predator.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));\r
+\r
+                       self.item_digestion_step = time + vore_steptime;\r
+               }\r
 \r
                if(stov(cvar_string("g_vore_regurgitatecolor_color_digest")))\r
                        self.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_digest"));\r
@@ -265,11 +292,17 @@ void Item_Consumable_Remove(entity e, float regurgitate)
 {\r
        if(regurgitate)\r
        {\r
+               float scalediff, sz;\r
+               sz = e.scale ? e.scale : 1; // the line below does not work if I define this directly (fteqcc bug?)\r
+               scalediff = cvar("g_healthsize") ? sz / e.predator.scale : sz; // the tighter the gut, the greater the velocity\r
+\r
                // predator effects, some common to those in Vore_Regurgitate\r
                PlayerSound(e.predator, playersound_regurgitate, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
                setanim(e.predator, e.predator.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
-               pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', 1);\r
-               e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_predator_punchangle_item");\r
+               pointparticles(particleeffectnum("vore_regurgitate"), e.predator.origin, '0 0 0', floor(scalediff * PARTICLE_MULTIPLIER));\r
+               e.predator.punchangle_x = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle_item") * scalediff;\r
+               e.predator.punchangle_y = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle_item") * scalediff;\r
+               e.predator.punchangle_z = crandom() * cvar("g_balance_vore_regurgitate_predator_punchangle_item") * scalediff;\r
                e.predator.regurgitate_prepare = 0;\r
                e.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
 \r
@@ -284,6 +317,7 @@ void Item_Consumable_Remove(entity e, float regurgitate)
 void Item_Consumable_Spawn(entity e, entity pl)\r
 {\r
        entity item;\r
+\r
        item = spawn();\r
        item.owner = e;\r
        item.classname = "consumable";\r
@@ -291,15 +325,24 @@ void Item_Consumable_Spawn(entity e, entity pl)
        item.solid = SOLID_NOT;\r
        setmodel(item, e.model);\r
        item.health = e.health;\r
-       item.inithealth = e.health;\r
+       if(e.inithealth)\r
+       {\r
+               item.inithealth = e.inithealth;\r
+               item.initdmg = e.initdmg;\r
+       }\r
+       else\r
+       {\r
+               item.inithealth = e.health;\r
+               item.initdmg = e.dmg;\r
+       }\r
        item.max_health = e.max_health;\r
-       item.dmg = e.dmg;\r
 \r
        item.predator = pl;\r
        item.aiment = pl;\r
        item.view_ofs_x = CONSUMABLE_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance_item");\r
        item.view_ofs_y = CONSUMABLE_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance_item");\r
-       item.view_ofs_z = CONSUMABLE_VIEW_OFS_z;\r
+       item.view_ofs_z = CONSUMABLE_VIEW_OFS_z + crandom() * cvar("g_vore_neighborprey_distance_item");\r
+       item.angles = randomvec() * 360;\r
 \r
        item.customizeentityforclient = Item_Consumable_Customizeentityforclient;\r
        item.think = Item_Consumable_Think;\r
@@ -308,13 +351,18 @@ void Item_Consumable_Spawn(entity e, entity pl)
        if(stov(cvar_string("g_vore_regurgitatecolor_color_normal")))\r
                item.colormod = stov(cvar_string("g_vore_regurgitatecolor_color_normal"));\r
 \r
+       float scalediff, sz;\r
+       sz = e.scale ? e.scale : 1; // the line below does not work if I define this directly (fteqcc bug?)\r
+       scalediff = cvar("g_healthsize") ? sz / pl.scale : sz; // the tighter the gut, the greater the velocity\r
+\r
        // predator effects, some common to those in Vore_Swallow\r
        PlayerSound(pl, playersound_swallow, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
        setanim(pl, pl.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing / regurgitating\r
-       pl.punchangle_x -= cvar("g_balance_vore_swallow_predator_punchangle_item");\r
+       pl.punchangle_x = crandom() * cvar("g_balance_vore_swallow_predator_punchangle_item") * scalediff;\r
+       pl.punchangle_y = crandom() * cvar("g_balance_vore_swallow_predator_punchangle_item") * scalediff;\r
+       pl.punchangle_z = crandom() * cvar("g_balance_vore_swallow_predator_punchangle_item") * scalediff;\r
        pl.regurgitate_prepare = 0;\r
        pl.action_delay = time + cvar("g_balance_vore_action_delay");\r
-       Vore_AutoDigest(pl);\r
 }\r
 \r
 void Item_DroppedConsumable_Touch()\r
@@ -323,7 +371,8 @@ void Item_DroppedConsumable_Touch()
                return;\r
 \r
        // give the consumable item to the player touching it\r
-       if(other.stomach_load + self.dmg <= other.stomach_maxload)\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
        {\r
                Item_Consumable_Spawn(self, other);\r
                remove(self);\r
@@ -342,17 +391,23 @@ void Item_DroppedConsumable_Spawn(entity e)
        setmodel(item, e.model);\r
        item.health = e.health;\r
        item.inithealth = e.inithealth;\r
+       item.initdmg = e.initdmg;\r
        item.max_health = e.max_health;\r
-       item.dmg = e.dmg;\r
        item.scale = e.scale;\r
        item.colormod = e.colormod;\r
 \r
+       if(cvar("g_nodepthtestitems"))\r
+               item.effects |= EF_NODEPTHTEST;\r
+\r
+       float scalediff, sz;\r
+       sz = e.scale ? e.scale : 1; // the line below does not work if I define this directly (fteqcc bug?)\r
+       scalediff = cvar("g_healthsize") ? sz / e.predator.scale : sz; // the tighter the gut, the greater the velocity\r
+\r
        setorigin(item, e.predator.origin);\r
        item.angles_y = e.predator.angles_y;\r
        makevectors(e.predator.v_angle);\r
-       item.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");\r
-       e.predator.velocity += -v_forward * cvar("g_balance_vore_regurgitate_predatorforce");\r
-\r
+       item.velocity = v_forward * cvar("g_balance_vore_regurgitate_force") * scalediff;\r
+       e.predator.velocity = e.predator.velocity + (-v_forward * cvar("g_balance_vore_regurgitate_predatorforce") * scalediff); // don't use += here to avoid a fteqcc bug\r
        item.touch = Item_DroppedConsumable_Touch;\r
        item.cnt = time + 1; // 1 second delay\r
        SUB_SetFade(item, time + 20, 1);\r
@@ -441,9 +496,10 @@ float Item_GiveTo(entity item, entity player)
 \r
                if (item.health)\r
                {\r
-                       if(item.dmg) // consumable item\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
@@ -1039,12 +1095,6 @@ void spawnfunc_item_health_large (void) {
 }\r
 \r
 void spawnfunc_item_health_mega (void) {\r
-       if(!cvar("g_powerup_superhealth"))\r
-               return;\r
-\r
-       if((g_arena || g_ca) && !cvar("g_arena_powerups"))\r
-               return;\r
-\r
        if(!self.max_health)\r
                self.max_health = g_pickup_healthmega_max;\r
        if(!self.health)\r