build Constructors 1

functions Methods 12

CanPickup (inventory)
bool
True when the given inventory is allowed to pick this item up (see Sandbox.BaseInventoryItem.OnCanPickup(Sandbox.InventoryComponent)). Queryable by UI - a pure check, nothing happens.
CanSwitchTo ()
bool
True when the inventory is allowed to make this the active item (see Sandbox.BaseInventoryItem.OnCanSwitchTo). Queryable by UI - a pure check, nothing happens.
OnAdded (inventory)
Called on the host when added to an inventory. Base does nothing.
OnAdding (inventory)
bool
About to be added to . Return false to refuse - optionally consuming this item instead (a duplicate weapon donates its ammo, a stackable merges into its stack). Runs on the host for every add - pickups, loadouts, code. Base allows it.
OnCanPickup (inventory)
bool
Can the given inventory pick this item up out of the world? Both the Use prompt and Touch pickup consult it, so a refused item shows no prompt - role-locked weapons, class restrictions, quest gates. Base allows it.
OnCanSwitchTo ()
bool
Return false to stop the inventory making this item active.
OnControl ()
Called each frame on the owning client while this is the active item - read input and drive the item's behaviour here (firing, reloading, aiming, etc). Pumped by the inventory; see Sandbox.InventoryComponent.Pump and Sandbox.InventoryComponent.ManualPumping. Base does nothing.
OnDrop ()
bool
Places this item in the world after being dropped. The default unparents it (keeping its world position), enables it, drops network ownership, and gives it a small toss if it has a Sandbox.Rigidbody. Return false to refuse the drop (e.g. bound items). Override to customise placement or behaviour.
OnEquipped ()
Called on every peer when this becomes the active item. Base does nothing.
OnHolstered ()
Called on every peer when this stops being the active item. Base does nothing.
OnHolstering (next)
bool
The inventory is about to switch away from this (the active) item - to , or to nothing when it's null. Return false to refuse and stay deployed (stash to finish a put-down and re-issue the switch), or handle it here - e.g. cancel an in-progress reload - and return true to allow the switch. Not called on forced holsters (death, removal, dropping). Base allows it.
OnRemoved (inventory)
Called on the host when removed from an inventory. Base does nothing.

Inheritance

people
Log in to reply
You can't reply if you're not logged in. That would be crazy.