return TRUE;
if(autocvar_g_powerups == 0)
return FALSE;
- if(g_lms)
- return FALSE;
if(g_ca)
return FALSE;
if(g_arena)
return TRUE;
if(autocvar_g_pickup_items == 0)
return FALSE;
- if(g_lms)
- return FALSE;
if(g_ca)
return FALSE;
if(g_weaponarena)
// 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;
+ }
- giveplayer = 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)
}
}
- if (other.classname != "player")
+ if not(IS_PLAYER(other))
return;
if (other.deadflag)
return;
return;
if (self.owner == other)
return;
- if(MUTATOR_CALLHOOK(ItemTouch))
- return;
+
+ switch(MUTATOR_CALLHOOK(ItemTouch))
+ {
+ case MUT_ITEMTOUCH_RETURN: { return; }
+ case MUT_ITEMTOUCH_PICKUP: { goto pickup; }
+ }
if (self.classname == "droppedweapon")
{
return;
}
+ :pickup
+
other.last_pickup = time;
pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);
return;
}
- if(activator.classname != "player")
+ if not(IS_PLAYER(activator))
return;
if(activator.deadflag != DEAD_NO)
return;