- if(item.spawnshieldtime)
- {
- if (item.ammo_shells)
- if ((player.ammo_shells < g_pickup_shells_max) || item.pickup_anyway)
- {
- pickedup = TRUE;
- 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) || item.pickup_anyway)
- {
- pickedup = TRUE;
- 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) || item.pickup_anyway)
- {
- pickedup = TRUE;
- 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) || item.pickup_anyway)
- {
- pickedup = TRUE;
- 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) || item.pickup_anyway)
- {
- pickedup = TRUE;
- 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);
- }
- }
+ 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);