]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_items.qc
Fix extra life powerup giving infinite lives in lms & minstagib
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qc
index 87fda06aef9b6a76675903a8ff4e66eec2acf88d..957e421e34279a437c2ce5ee32893d82f26a44be 100644 (file)
@@ -277,8 +277,6 @@ float have_pickup_item(void)
                        return TRUE;
                if(autocvar_g_powerups == 0)
                        return FALSE;
-               if(g_lms)
-                       return FALSE;
                if(g_ca)
                        return FALSE;
                if(g_arena)
@@ -290,8 +288,6 @@ float have_pickup_item(void)
                        return TRUE;
                if(autocvar_g_pickup_items == 0)
                        return FALSE;
-               if(g_lms)
-                       return FALSE;
                if(g_ca)
                        return FALSE;
                if(g_weaponarena)
@@ -600,72 +596,68 @@ float Item_GiveTo(entity item, entity player)
        // if nothing happens to player, just return without taking the item
        pickedup = FALSE;
        _switchweapon = FALSE;
+       // in case the player has autoswitch enabled do the following:
+       // if the player is using their best weapon before items are given, they
+       // probably want to switch to an even better weapon after items are given
+       if (player.autoswitch)
+       if (player.switchweapon == w_getbestweapon(player))
+               _switchweapon = TRUE;
 
-               // in case the player has autoswitch enabled do the following:
-               // if the player is using their best weapon before items are given, they
-               // probably want to switch to an even better weapon after items are given
-               if (player.autoswitch)
-               if (player.switchweapon == w_getbestweapon(player))
-                       _switchweapon = TRUE;
-
-               if not(WEPSET_CONTAINS_EW(player, player.switchweapon))
-                       _switchweapon = TRUE;
-
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_shells, g_pickup_shells_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_nails, g_pickup_nails_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_rockets, g_pickup_rockets_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, g_pickup_cells_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, health, item.max_health, ITEM_MODE_HEALTH);
-               pickedup |= Item_GiveAmmoTo(item, player, armorvalue, item.max_armorvalue, ITEM_MODE_ARMOR);
+       if not(WEPSET_CONTAINS_EW(player, player.switchweapon))
+               _switchweapon = TRUE;
 
-               if (item.flags & FL_WEAPON)
-               {
-                       WEPSET_DECLARE_A(it);
-                       WEPSET_COPY_AE(it, item);
-                       WEPSET_ANDNOT_AE(it, player);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_shells, g_pickup_shells_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_nails, g_pickup_nails_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_rockets, g_pickup_rockets_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, g_pickup_cells_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, health, item.max_health, ITEM_MODE_HEALTH);
+       pickedup |= Item_GiveAmmoTo(item, player, armorvalue, item.max_armorvalue, ITEM_MODE_ARMOR);
 
-                       if (!WEPSET_EMPTY_A(it) || (item.spawnshieldtime && self.pickup_anyway))
-                       {
-                               pickedup = TRUE;
-                               for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-                                       if(WEPSET_CONTAINS_AW(it, i))
-                                               W_GiveWeapon(player, i);
-                       }
-               }
+       if (item.flags & FL_WEAPON)
+       {
+               WEPSET_DECLARE_A(it);
+               WEPSET_COPY_AE(it, item);
+               WEPSET_ANDNOT_AE(it, player);
 
-               if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
+               if (!WEPSET_EMPTY_A(it) || (item.spawnshieldtime && item.pickup_anyway))
                {
                        pickedup = TRUE;
-                       player.items |= it;
-                       sprint (player, strcat("You got the ^2", item.netname, "\n"));
+                       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+                       if(WEPSET_CONTAINS_AW(it, i))
+                               W_GiveWeapon(player, i);
                }
+       }
 
-               if (item.strength_finished)
-               {
-                       pickedup = TRUE;
-                       player.strength_finished = max(player.strength_finished, time) + item.strength_finished;
-               }
-               if (item.invincible_finished)
-               {
-                       pickedup = TRUE;
-                       player.invincible_finished = max(player.invincible_finished, time) + item.invincible_finished;
-               }
-               if (item.superweapons_finished)
-               {
-                       pickedup = TRUE;
-                       player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
-               }
+       if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
+       {
+               pickedup = TRUE;
+               player.items |= it;
+               sprint (player, strcat("You got the ^2", item.netname, "\n"));
+       }
 
-:skip
+       if (item.strength_finished)
+       {
+               pickedup = TRUE;
+               player.strength_finished = max(player.strength_finished, time) + item.strength_finished;
+       }
+       if (item.invincible_finished)
+       {
+               pickedup = TRUE;
+               player.invincible_finished = max(player.invincible_finished, time) + item.invincible_finished;
+       }
+       if (item.superweapons_finished)
+       {
+               pickedup = TRUE;
+               player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
+       }
+       if (item.max_health)
+       {
+               pickedup = TRUE;
+               // extra life powerup handled by mutators
+       }
 
-       other = player;
-       giveitem = item;
-       player_wswitch = _switchweapon;
-       player_pickedup = pickedup;
-       MUTATOR_CALLHOOK(Item_GiveTo);
-       _switchweapon = player_wswitch;
-       pickedup = player_pickedup;
+:skip
        
        // always eat teamed entities
        if(item.team)