ItemWeapon is the base class for items that give the player a weapon while equipped.
A derived item sets weapon_class, the class of the weapon ('weapon_pistol' by
default), and usually equip_slot, which is 'item.slot.primary' by default.
Equipping the item gives the weapon to the player and selects it; unequipping strips
it. The rounds in both clips of the weapon are stored in the ammo data of the item
when it is unequipped and when the character is saved, and loaded back when it is
equipped. The unload button of the menu moves the loaded rounds to the ammo reserve
of the player.
Summary
Methods
Methods
Called on the server before the character of the player that has the item is saved. Stores the contents of the weapon's clips in the item's data if the item is equipped.
Parameters
- owner Player
Called on the server when a player presses the unload button in the item's menu. Empties the clips of the weapon and gives the ammo back to the player. Does nothing if the item is not equipped or the player does not have its weapon.
Parameters
- owner Player
Called when the item gets equipped. Gives the player the weapon, selects it and loads its clips with the ammo that is stored in the item's data.
Parameters
- owner Player
Called when the item gets unequipped. Strips the weapon from the player and stores the contents of its clips in the item's data.
Parameters
- owner Player