Skip to content

Inventory - Types/Gridinv

This page documents the hooks defined by the types/gridinv submodule in the inventory module.


BagInventoryReady(item, inventory)View Source

Purpose

Called after a bag item finishes creating or restoring its nested inventory.

Realm

Server

Parameters

table item The bag item that owns the nested inventory.

table inventory The nested bag inventory that is now ready.


BagInventoryRemoved(item, inventory)View Source

Purpose

Called when a bag item's nested inventory is removed.

Realm

Server

Parameters

table item The bag item losing its nested inventory.

table inventory The nested inventory being removed.


InterceptClickItemIcon(panel, itemIcon, keyCode)View Source

Purpose

Allows clientside code to intercept clicks on a grid inventory item icon before default handling runs.

Realm

Client

Parameters

Panel panel The grid inventory panel receiving the click.

Panel itemIcon The clicked item icon panel.

number keyCode The mouse key or button code that was pressed.

Returns

boolean|nil Return true to indicate the click was fully handled and skip default processing.


InventoryItemIconCreated(icon, item, panel)View Source

Purpose

Called after a grid inventory item icon panel is created.

Realm

Client

Parameters

Panel icon The newly created item icon panel.

table item The inventory item represented by the icon.

Panel panel The parent grid inventory panel.


InventoryPanelCreated(panel, inventory, parent)View Source

Purpose

Called after a grid inventory panel is created.

Realm

Client

Parameters

Panel panel The created inventory panel.

table inventory The inventory assigned to the panel.

Panel parent optional The parent panel, if one was provided.


ItemCombine(client, item, target)View Source

Purpose

Allows code to handle combining one item with another before default transfer behavior continues.

Realm

Server

Parameters

Player client The player attempting the combine action.

table item The item being moved or used.

table target The item being combined with.

Returns

boolean|nil Return true when the combine action was handled successfully.


OnPlayerLostStackItem(itemTypeOrItem)View Source

Purpose

Called when the grid inventory stack restore flow fails to recover an item.

Realm

Server

Parameters

string|table itemTypeOrItem The item type or item reference that could not be restored.


OnRequestItemTransfer(panel, itemID, inventoryID, x, y)View Source

Purpose

Called on the client when a grid inventory panel requests an item transfer.

Realm

Client

Parameters

Panel panel The panel that initiated the transfer request.

number itemID The item ID being transferred.

number inventoryID optional The target inventory ID, if applicable.

number x The requested destination X slot.

number y The requested destination Y slot.


SetupBagInventoryAccessRules(inventory)View Source

Purpose

Allows code to configure access rules on a newly created bag inventory.

Realm

Server

Parameters

table inventory The bag inventory being initialized.