Inventory
constInventory:object
Defined in: client/api.d.ts:3658
Client-side overrides for actions in the local player’s native inventory. Register by catalog item name, class GUID, custom item id, or { uid } for one native instance. A matching handler replaces the action before native consumption or effects. Scripts run on the next feature update, outside the native detour; return values are ignored and errors do not restore the native action. Only owned, synchronized inventory items dispatch. Pending uses are discarded if their handler, native item, server row or inventory revision disappears or changes. Instance handlers take priority over class handlers; otherwise the newest matching registration wins. Removing it reveals the earlier handler. Resource stop and session end remove handlers. The server remains responsible for validating requests, consuming inventory and applying effects. This API does not intercept quick-slot actions outside the inventory.
Type Declaration
Section titled “Type Declaration”offUse()
Section titled “offUse()”offUse(
handlerId):boolean
Removes a handler owned by the calling resource and discards its pending uses.
Parameters
Section titled “Parameters”handlerId
Section titled “handlerId”number
Id returned by onUse.
Returns
Section titled “Returns”boolean
False if the registration is missing or belongs to another resource.
onUse()
Section titled “onUse()”onUse(
item,handler):number
Registers an inventory action override for this resource. Adds a Use action even for an item without a normal primary action. Duplicate presses on the same UID within one frame are combined.
Parameters
Section titled “Parameters”string | { uid: string; }
Catalog name such as apple, a class GUID, a custom item id, or a native UID from InventoryUse.uid.
handler
Section titled “handler”(use) => void
Runs instead of the native action. No item is automatically consumed.
Returns
Section titled “Returns”number
A registration id for offUse. Throws for an unknown class, invalid UID, missing resource or more than 256 active registrations.