]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_items.qc
Merge commit '7b4c329'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qc
index 9d32f3234bf7ae2f429f4c4038f84e1666cc67df..143b3be4879d79cc2993a685f275e0a1cc2e0bee 100644 (file)
@@ -40,6 +40,7 @@ string Item_CounterFieldName(float it)
 }
 
 .float max_armorvalue;
+.float pickup_anyway;
 
 float Item_Customize()
 {
@@ -56,7 +57,7 @@ float Item_Customize()
        {
                if(g_ghost_items)
                {
-                       self.colormod = stov(cvar_string("g_ghost_items_color"));
+                       self.colormod = stov(autocvar_g_ghost_items_color);
                        self.glowmod = self.colormod;
                        self.alpha = g_ghost_items;
                        return TRUE;
@@ -110,8 +111,8 @@ void Item_Show (entity e, float mode)
                // make the item translucent green and not touchable
                e.model = e.mdl;
                e.solid = SOLID_NOT;
-               e.colormod = stov(cvar_string("g_ghost_items_color"));
-               self.glowmod = self.colormod;
+               e.colormod = stov(autocvar_g_ghost_items_color);
+               e.glowmod = e.colormod;
                e.alpha = g_ghost_items;
                e.customizeentityforclient = func_null;
 
@@ -122,8 +123,8 @@ void Item_Show (entity e, float mode)
                // hide the item completely
                e.model = string_null;
                e.solid = SOLID_NOT;
-               e.colormod = stov(cvar_string("g_ghost_items_color"));
-               self.glowmod = self.colormod;
+               e.colormod = stov(autocvar_g_ghost_items_color);
+               e.glowmod = e.colormod;
                e.alpha = 0;
                e.customizeentityforclient = func_null;
 
@@ -132,9 +133,9 @@ void Item_Show (entity e, float mode)
 
        if (e.strength_finished || e.invincible_finished)
                e.effects |= EF_ADDITIVE | EF_FULLBRIGHT;
-       if (cvar("g_nodepthtestitems"))
+       if (autocvar_g_nodepthtestitems)
                e.effects |= EF_NODEPTHTEST;
-       if (cvar("g_fullbrightitems"))
+       if (autocvar_g_fullbrightitems)
                e.effects |= EF_FULLBRIGHT;
 
        // relink entity (because solid may have changed)
@@ -232,8 +233,13 @@ void Item_ScheduleRespawnIn(entity e, float t)
 
 void Item_ScheduleRespawn(entity e)
 {
-       Item_Show(e, 0);
-       Item_ScheduleRespawnIn(e, ITEM_RESPAWNTIME(e));
+       if(e.respawntime > 0)
+       {
+               Item_Show(e, 0);
+               Item_ScheduleRespawnIn(e, ITEM_RESPAWNTIME(e));
+       }
+       else // if respawntime is -1, this item does not respawn
+               Item_Show(e, -1);
 }
 
 void Item_ScheduleInitialRespawn(entity e)
@@ -262,8 +268,8 @@ float Item_GiveTo(entity item, entity player)
                        if (player.ammo_fuel < g_pickup_fuel_max)
                        {
                                pickedup = TRUE;
-                               player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
-                               player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
+                               player.ammo_fuel = bound(player.ammo_fuel, g_pickup_fuel_max, player.ammo_fuel + item.ammo_fuel);
+                               player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + autocvar_g_balance_pause_fuel_rot);
                        }
                        if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
                        {
@@ -290,9 +296,9 @@ float Item_GiveTo(entity item, entity player)
                                //      AnnounceTo(player, "ammo");
 
                                if (item.weapons & WEPBIT_MINSTANEX)
-                                       W_GiveWeapon (player, WEP_MINSTANEX, "Nex");
+                                       W_GiveWeapon (player, WEP_MINSTANEX, item.netname);
                                if (item.ammo_cells)
-                                       player.ammo_cells = min (player.ammo_cells + cvar("g_minstagib_ammo_drop"), 999);
+                                       player.ammo_cells = bound(player.ammo_cells, 999, player.ammo_cells + autocvar_g_minstagib_ammo_drop);
                                player.health = 100;
                        }
 
@@ -302,7 +308,7 @@ float Item_GiveTo(entity item, entity player)
                                pickedup = TRUE;
                                // sound not available
                                // AnnounceTo(player, "_lives");
-                               player.armorvalue = player.armorvalue + cvar("g_minstagib_extralives");
+                               player.armorvalue = bound(player.armorvalue, 999, player.armorvalue + autocvar_g_minstagib_extralives);
                                sprint(player, "^3You picked up some extra lives\n");
                        }
 
@@ -312,7 +318,7 @@ float Item_GiveTo(entity item, entity player)
                                pickedup = TRUE;
                                // sound not available
                                // AnnounceTo(player, "invisible");
-                               player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
+                               player.strength_finished = max(player.strength_finished, time) + autocvar_g_balance_powerup_strength_time;
                        }
 
                        // speed powerup
@@ -321,15 +327,7 @@ float Item_GiveTo(entity item, entity player)
                                pickedup = TRUE;
                                // sound not available
                                // AnnounceTo(player, "speed");
-                               player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_strength_time");
-                       }
-
-                       if (item.ammo_fuel)
-                       if (player.ammo_fuel < g_pickup_fuel_max)
-                       {
-                               pickedup = TRUE;
-                               player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
-                               player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
+                               player.invincible_finished = max(player.invincible_finished, time) + autocvar_g_balance_powerup_strength_time;
                        }
                }
        }
@@ -364,40 +362,40 @@ float Item_GiveTo(entity item, entity player)
                if(item.spawnshieldtime)
                {
                        if (item.ammo_shells)
-                       if (player.ammo_shells < g_pickup_shells_max)
+                       if ((player.ammo_shells < g_pickup_shells_max) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
-                               player.ammo_shells = min (player.ammo_shells + item.ammo_shells, g_pickup_shells_max);
+                               player.ammo_shells = bound(player.ammo_shells, g_pickup_shells_max, player.ammo_shells + item.ammo_shells);
                        }
                        if (item.ammo_nails)
-                       if (player.ammo_nails < g_pickup_nails_max)
+                       if ((player.ammo_nails < g_pickup_nails_max) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
-                               player.ammo_nails = min (player.ammo_nails + item.ammo_nails, g_pickup_nails_max);
+                               player.ammo_nails = bound(player.ammo_nails, g_pickup_nails_max, player.ammo_nails + item.ammo_nails);
                        }
                        if (item.ammo_rockets)
-                       if (player.ammo_rockets < g_pickup_rockets_max)
+                       if ((player.ammo_rockets < g_pickup_rockets_max) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
-                               player.ammo_rockets = min (player.ammo_rockets + item.ammo_rockets, g_pickup_rockets_max);
+                               player.ammo_rockets = bound(player.ammo_rockets, g_pickup_rockets_max, player.ammo_rockets + item.ammo_rockets);
                        }
                        if (item.ammo_cells)
-                       if (player.ammo_cells < g_pickup_cells_max)
+                       if ((player.ammo_cells < g_pickup_cells_max) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
-                               player.ammo_cells = min (player.ammo_cells + item.ammo_cells, g_pickup_cells_max);
+                               player.ammo_cells = bound(player.ammo_cells, g_pickup_cells_max, player.ammo_cells + item.ammo_cells);
                        }
                        if (item.ammo_fuel)
-                       if (player.ammo_fuel < g_pickup_fuel_max)
+                       if ((player.ammo_fuel < g_pickup_fuel_max) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
-                               player.ammo_fuel = min(player.ammo_fuel + item.ammo_fuel, g_pickup_fuel_max);
-                               player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + cvar("g_balance_pause_fuel_rot"));
+                               player.ammo_fuel = bound(player.ammo_fuel, g_pickup_fuel_max, player.ammo_fuel + item.ammo_fuel);
+                               player.pauserotfuel_finished = max(player.pauserotfuel_finished, time + autocvar_g_balance_pause_fuel_rot);
                        }
                }
 
                if (item.flags & FL_WEAPON)
-               if ((it = item.weapons - (item.weapons & player.weapons)))
+               if ((it = item.weapons - (item.weapons & player.weapons)) || g_pickup_weapons_anyway)
                {
                        pickedup = TRUE;
                        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
@@ -420,27 +418,27 @@ float Item_GiveTo(entity item, entity player)
                        if (item.strength_finished)
                        {
                                pickedup = TRUE;
-                               player.strength_finished = max(player.strength_finished, time) + cvar("g_balance_powerup_strength_time");
+                               player.strength_finished = max(player.strength_finished, time) + autocvar_g_balance_powerup_strength_time;
                        }
                        if (item.invincible_finished)
                        {
                                pickedup = TRUE;
-                               player.invincible_finished = max(player.invincible_finished, time) + cvar("g_balance_powerup_invincible_time");
+                               player.invincible_finished = max(player.invincible_finished, time) + autocvar_g_balance_powerup_invincible_time;
                        }
 
                        if (item.health)
-                       if (player.health < item.max_health)
+                       if ((player.health < item.max_health) || item.pickup_anyway)
                        {
                                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"));
+                               player.health = bound(player.health, item.max_health, player.health + item.health);
+                               player.pauserothealth_finished = max(player.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
                        }
                        if (item.armorvalue)
-                       if (player.armorvalue < item.max_armorvalue)
+                       if ((player.armorvalue < item.max_armorvalue) || item.pickup_anyway)
                        {
                                pickedup = TRUE;
-                               player.armorvalue = min(player.armorvalue + item.armorvalue, item.max_armorvalue);
-                               player.pauserotarmor_finished = max(player.pauserotarmor_finished, time + cvar("g_balance_pause_armor_rot"));
+                               player.armorvalue = bound(player.armorvalue, item.max_armorvalue, player.armorvalue + item.armorvalue);
+                               player.pauserotarmor_finished = max(player.pauserotarmor_finished, time + autocvar_g_balance_pause_armor_rot);
                        }
                }
        }
@@ -483,6 +481,8 @@ void Item_Touch (void)
        if(!Item_GiveTo(self, other))
                return;
 
+       other.last_pickup = time;
+
        pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);
 
        if (self.classname == "droppedweapon")
@@ -590,7 +590,7 @@ float weapon_pickupevalfunc(entity player, entity item)
        // If custom weapon priorities for bots is enabled rate most wanted weapons higher
        if( bot_custom_weapon && c )
        {
-               for(i = WEP_FIRST; i < WEP_LAST ; ++i)
+               for(i = WEP_FIRST; i <= WEP_LAST ; ++i)
                {
                        // Find weapon
                        if( (get_weaponinfo(i)).weapons & item.weapons  != item.weapons )
@@ -630,7 +630,7 @@ float commodity_pickupevalfunc(entity player, entity item)
        c = 0;
 
        // Detect needed ammo
-       for(i = WEP_FIRST; i < WEP_LAST ; ++i)
+       for(i = WEP_FIRST; i <= WEP_LAST ; ++i)
        {
                wi = get_weaponinfo(i);
 
@@ -682,6 +682,9 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
 {
        startitem_failed = FALSE;
 
+       self.items = itemid;
+       self.weapons = weaponid;
+
        // is it a dropped weapon?
        if (self.classname == "droppedweapon")
        {
@@ -702,9 +705,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        }
        else
        {
-               self.items = itemid;
-               self.weapons = weaponid;
-
                if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
                {
                        startitem_failed = TRUE;
@@ -712,9 +712,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                        return;
                }
 
-               itemid = self.items;
-               weaponid = self.weapons;
-
                self.reset = Item_Reset;
                // it's a level item
                if(self.spawnflags & 1)
@@ -782,7 +779,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                }
                */
 
-               if(cvar("spawn_debug") >= 2)
+               if(autocvar_spawn_debug >= 2)
                {
                        entity otheritem;
                        for(otheritem = findradius(self.origin, 3); otheritem; otheritem = otheritem.chain)
@@ -797,8 +794,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                        self.is_item = TRUE;
                }
 
-               weaponsInMap |= weaponid;
-
                if(g_lms || g_ca)
                {
                        startitem_failed = TRUE;
@@ -821,24 +816,27 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                                return;
                        }
                }
-               else if (!cvar("g_pickup_items") && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH)
+               else if (!autocvar_g_pickup_items && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH)
                {
                        startitem_failed = TRUE;
                        remove (self);
                        return;
                }
 
+               weaponsInMap |= weaponid;
+
                precache_model (itemmodel);
                precache_sound (pickupsound);
-               precache_sound ("misc/itemrespawn.wav");
-               precache_sound ("misc/itemrespawncountdown.wav");
 
-               if(itemid == IT_STRENGTH)
+               precache_sound ("misc/itemrespawncountdown.wav");
+               if(!g_minstagib && itemid == IT_STRENGTH)
                        precache_sound ("misc/strength_respawn.wav");
-               if(itemid == IT_INVINCIBLE)
+               else if(!g_minstagib && itemid == IT_INVINCIBLE)
                        precache_sound ("misc/shield_respawn.wav");
+               else
+                       precache_sound ("misc/itemrespawn.wav");
 
-               if((itemid & (IT_STRENGTH | IT_INVINCIBLE | IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2)) || (weaponid & WEPBIT_ALL))
+               if((itemflags & (FL_POWERUP | FL_WEAPON)) || (itemid & (IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2)))
                        self.target = "###item###"; // for finding the nearest item using find()
        }
 
@@ -892,16 +890,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
  */
 void minstagib_items (float itemid)
 {
-       // we don't want to replace dropped weapons ;)
-       if (self.classname == "droppedweapon")
-       {
-               self.ammo_cells = 25;
-               StartItem ("models/weapons/g_nex.md3",
-                       "weapons/weaponpickup.wav", 15, 0,
-                       "MinstaNex", 0, WEPBIT_MINSTANEX, FL_WEAPON, generic_pickupevalfunc, 1000);
-               return;
-       }
-
        local float rnd;
        self.classname = "minstagib";
 
@@ -911,7 +899,7 @@ void minstagib_items (float itemid)
                self.ammo_cells = 1;
                StartItem ("models/items/a_cells.md3",
                        "misc/itempickup.wav", 45, 0,
-                       "Nex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
+                       "MinstaNex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
                return;
        }
 
@@ -939,7 +927,6 @@ void minstagib_items (float itemid)
                StartItem ("models/items/g_h100.md3",
                        "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
                        "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
-
        }
        // replace with speed
        if (itemid == IT_INVINCIBLE)
@@ -949,7 +936,6 @@ void minstagib_items (float itemid)
                        "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
                        "Speed", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
        }
-
 }
 
 float minst_no_auto_cells;
@@ -1060,7 +1046,7 @@ void weapon_defaultspawnfunc(float wpn)
                        {
                                ammofield = Item_CounterField(j);
                                if(!self.ammofield)
-                                       self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j)));
+                                       self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon"));
                        }
                }
        }
@@ -1137,7 +1123,7 @@ void spawnfunc_weapon_rocketlauncher (void)
 {
        if (g_minstagib)
        {
-               minstagib_items(IT_CELLS);
+               minstagib_items(IT_CELLS); // replace rocketlauncher with cells
                self.think = minst_remove_item;
                self.nextthink = time;
                return;
@@ -1148,6 +1134,8 @@ void spawnfunc_weapon_rocketlauncher (void)
 void spawnfunc_item_rockets (void) {
        if(!self.ammo_rockets)
                self.ammo_rockets = g_pickup_rockets;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_ammo_anyway;
        StartItem ("models/items/a_rockets.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "rockets", IT_ROCKETS, 0, 0, commodity_pickupevalfunc, 3000);
 }
 
@@ -1165,12 +1153,16 @@ void spawnfunc_item_bullets (void) {
 
        if(!self.ammo_nails)
                self.ammo_nails = g_pickup_nails;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_ammo_anyway;
        StartItem ("models/items/a_bullets.mdl", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "bullets", IT_NAILS, 0, 0, commodity_pickupevalfunc, 2000);
 }
 
 void spawnfunc_item_cells (void) {
        if(!self.ammo_cells)
                self.ammo_cells = g_pickup_cells;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_ammo_anyway;
        StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "cells", IT_CELLS, 0, 0, commodity_pickupevalfunc, 2000);
 }
 
@@ -1187,6 +1179,8 @@ void spawnfunc_item_shells (void) {
 
        if(!self.ammo_shells)
                self.ammo_shells = g_pickup_shells;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_ammo_anyway;
        StartItem ("models/items/a_shells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "shells", IT_SHELLS, 0, 0, commodity_pickupevalfunc, 500);
 }
 
@@ -1195,7 +1189,9 @@ void spawnfunc_item_armor_small (void) {
                self.armorvalue = g_pickup_armorsmall;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armorsmall_max;
-       StartItem ("models/items/g_a1.md3", "misc/armor1.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Armor", IT_ARMOR_SHARD, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armorsmall_anyway;
+       StartItem ("models/items/item_armor_small.md3", "misc/armor1.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Armor", IT_ARMOR_SHARD, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
 }
 
 void spawnfunc_item_armor_medium (void) {
@@ -1203,7 +1199,9 @@ void spawnfunc_item_armor_medium (void) {
                self.armorvalue = g_pickup_armormedium;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armormedium_max;
-       StartItem ("models/items/g_armormedium.md3", "misc/armor10.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "25 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armormedium_anyway;
+       StartItem ("models/items/item_armor_medium.md3", "misc/armor10.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "25 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
 }
 
 void spawnfunc_item_armor_big (void) {
@@ -1211,7 +1209,9 @@ void spawnfunc_item_armor_big (void) {
                self.armorvalue = g_pickup_armorbig;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armorbig_max;
-       StartItem ("models/items/g_a50.md3", "misc/armor17_5.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "50 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, 20000);
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armorbig_anyway;
+       StartItem ("models/items/item_armor_big.md3", "misc/armor17_5.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "50 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, 20000);
 }
 
 void spawnfunc_item_armor_large (void) {
@@ -1219,7 +1219,9 @@ void spawnfunc_item_armor_large (void) {
                self.armorvalue = g_pickup_armorlarge;
        if(!self.max_armorvalue)
                self.max_armorvalue = g_pickup_armorlarge_max;
-       StartItem ("models/items/g_a25.md3", "misc/armor25.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_armorlarge_anyway;
+       StartItem ("models/items/item_armor_large.md3", "misc/armor25.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
 }
 
 void spawnfunc_item_health_small (void) {
@@ -1227,6 +1229,8 @@ void spawnfunc_item_health_small (void) {
                self.max_health = g_pickup_healthsmall_max;
        if(!self.health)
                self.health = g_pickup_healthsmall;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_healthsmall_anyway;
        StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Health", IT_5HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
 }
 
@@ -1235,6 +1239,8 @@ void spawnfunc_item_health_medium (void) {
                self.max_health = g_pickup_healthmedium_max;
        if(!self.health)
                self.health = g_pickup_healthmedium;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_healthmedium_anyway;
        StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "25 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
 }
 
@@ -1243,14 +1249,16 @@ void spawnfunc_item_health_large (void) {
                self.max_health = g_pickup_healthlarge_max;
        if(!self.health)
                self.health = g_pickup_healthlarge;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_healthlarge_anyway;
        StartItem ("models/items/g_h50.md3", "misc/mediumhealth.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "50 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
 }
 
 void spawnfunc_item_health_mega (void) {
-       if(!cvar("g_powerup_superhealth"))
+       if(!autocvar_g_powerup_superhealth)
                return;
 
-       if((g_arena || g_ca) && !cvar("g_arena_powerups"))
+       if((g_arena || g_ca) && !autocvar_g_arena_powerups)
                return;
 
        if(g_minstagib) {
@@ -1260,6 +1268,8 @@ void spawnfunc_item_health_mega (void) {
                        self.max_health = g_pickup_healthmega_max;
                if(!self.health)
                        self.health = g_pickup_healthmega;
+               if(!self.pickup_anyway)
+                       self.pickup_anyway = g_pickup_healthmega_anyway;
                StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Health", IT_HEALTH, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
        }
 }
@@ -1272,10 +1282,10 @@ void spawnfunc_item_health25() { spawnfunc_item_health_medium(); }
 void spawnfunc_item_health100() { spawnfunc_item_health_mega(); }
 
 void spawnfunc_item_strength (void) {
-       if(!cvar("g_powerup_strength"))
+       if(!autocvar_g_powerup_strength)
                return;
 
-       if((g_arena || g_ca) && !cvar("g_arena_powerups"))
+       if((g_arena || g_ca) && !autocvar_g_arena_powerups)
                return;
 
        if(g_minstagib) {
@@ -1288,10 +1298,10 @@ void spawnfunc_item_strength (void) {
 }
 
 void spawnfunc_item_invincible (void) {
-       if(!cvar("g_powerup_shield"))
+       if(!autocvar_g_powerup_shield)
                return;
 
-       if((g_arena || g_ca) && !cvar("g_arena_powerups"))
+       if((g_arena || g_ca) && !autocvar_g_arena_powerups)
                return;
 
        if(g_minstagib) {
@@ -1347,13 +1357,10 @@ void spawnfunc_target_items (void)
 
        self.use = target_items_use;
        if(!self.strength_finished)
-               self.strength_finished = cvar("g_balance_powerup_strength_time");
+               self.strength_finished = autocvar_g_balance_powerup_strength_time;
        if(!self.invincible_finished)
-               self.invincible_finished = cvar("g_balance_powerup_invincible_time");
+               self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
 
-       precache_sound("misc/itempickup.wav");
-       precache_sound("misc/itempickup.wav");
-       precache_sound("misc/itempickup.wav");
        precache_sound("misc/itempickup.wav");
        precache_sound("misc/megahealth.wav");
        precache_sound("misc/armor25.wav");
@@ -1460,6 +1467,8 @@ void spawnfunc_item_fuel(void)
 {
        if(!self.ammo_fuel)
                self.ammo_fuel = g_pickup_fuel;
+       if(!self.pickup_anyway)
+               self.pickup_anyway = g_pickup_ammo_anyway;
        StartItem ("models/items/g_fuel.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "Fuel", IT_FUEL, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
 }
 
@@ -1487,12 +1496,6 @@ void spawnfunc_item_jetpack(void)
        StartItem ("models/items/g_jetpack.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Jet pack", IT_JETPACK, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
 }
 
-// we no longer have the seeker
-void spawnfunc_weapon_seeker()
-{
-       spawnfunc_weapon_fireball();
-}
-
 
 #define OP_SET 0
 #define OP_MIN 1
@@ -1646,8 +1649,8 @@ float GiveItems(entity e, float beginarg, float endarg)
                                continue;
                        case "ALL":
                                got += GiveBit(e, items, IT_FUEL_REGEN, op, val);
-                               got += GiveValue(e, strength_finished, op, time + val);
-                               got += GiveValue(e, invincible_finished, op, time + val);
+                               got += GiveValue(e, strength_finished, op, time);
+                               got += GiveValue(e, invincible_finished, op, time);
                                got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val);
                        case "all":
                                got += GiveBit(e, items, IT_JETPACK, op, val);
@@ -1749,9 +1752,15 @@ float GiveItems(entity e, float beginarg, float endarg)
        POSTGIVE_VALUE(e, ammo_cells, 0, "misc/itempickup.wav", string_null);
        POSTGIVE_VALUE(e, ammo_shells, 0, "misc/itempickup.wav", string_null);
        POSTGIVE_VALUE(e, ammo_rockets, 0, "misc/itempickup.wav", string_null);
-       POSTGIVE_VALUE_ROT(e, ammo_fuel, 1, pauserotfuel_finished, cvar("g_balance_pause_fuel_rot"), pauseregen_finished, cvar("g_balance_pause_fuel_regen"), "misc/itempickup.wav", string_null);
-       POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, cvar("g_balance_pause_armor_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/armor25.wav", string_null);
-       POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, cvar("g_balance_pause_health_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), "misc/megahealth.wav", string_null);
+       POSTGIVE_VALUE_ROT(e, ammo_fuel, 1, pauserotfuel_finished, autocvar_g_balance_pause_fuel_rot, pauseregen_finished, autocvar_g_balance_pause_fuel_regen, "misc/itempickup.wav", string_null);
+       POSTGIVE_VALUE_ROT(e, armorvalue, 1, pauserotarmor_finished, autocvar_g_balance_pause_armor_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, "misc/armor25.wav", string_null);
+       POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, "misc/megahealth.wav", string_null);
+
+       if (g_minstagib)
+       {
+               e.health = bound(0, e.health, 100);
+               e.armorvalue = bound(0, e.armorvalue, 999);
+       }
 
        if(e.strength_finished <= 0)
                e.strength_finished = 0;