ItemThrowable is the base class for weapons that are used up when thrown, such as grenades. A derived item sets weapon_class, the class of the weapon ('weapon_frag' by default), and thrown_ammo_class, the ammo type that the weapon throws ('Grenade' by default). Equipping the item gives the weapon with a single piece of that ammo and makes it the active weapon. Unequipping strips the weapon and, if the ammo is gone, takes the item away from the player. The Inventory plugin takes equipped throwable items away when the PlayerThrewGrenade hook is run.

Summary

Methods

Called when the item gets equipped.
Called when the item gets unequipped.

Methods

ItemThrowable:post_equipped(owner)

shared plugins/items/plugin/items/bases/sh_item_throwable.lua:35

Called when the item gets equipped. Gives the player the throwable weapon with a single piece of ammo and makes it active.

Parameters

  • owner Player

ItemThrowable:post_unequipped(owner)

shared plugins/items/plugin/items/bases/sh_item_throwable.lua:49

Called when the item gets unequipped. Strips the weapon from the player and takes the item away from them if they have no ammo for it left.

Parameters

  • owner Player

Defined in