SetWorldItemInteractable
Switches one loose item of the level off - it stays where it lies, and nobody can pick it up.
With false the item of that one slot stays where the level placed it, on every player’s screen, with no pickup prompt,
no pickup and no physics: a display on a merchant’s table, the props of a scene, a shrine’s offerings. It is the slot’s, never
the item’s class - the same bread on the next table can still be taken. true makes it usable again.
Every player is told at once, and a player coming near later finds it switched off too. The switch is kept across server
restarts with the rest of the level’s record ([containers] persist), and it belongs to the slot whatever happens to its
item: a taken item (TakeWorldItem) switched off comes back switched off (ResetWorldItem, the restock). The key is
one GetWorldItemsNear lists; false and the reason for a key the level’s tables export does not know (or without the
export). Switching a slot to the state it is in already is no change and answers true.
Syntax
Section titled “Syntax”SetWorldItemInteractable(key, interactable)| Parameter | Type | |
|---|---|---|
key |
string | the item slot’s key, as GetWorldItemsNear lists it |
interactable |
boolean | false switches the item off, true back on |
Returns
Section titled “Returns”boolean, string - true; or false and why not
Example
Section titled “Example”-- the merchant's wares on show: nobody walks off with themfor _, slot in ipairs(GetWorldItemsNear(STALL_X, STALL_Y, STALL_Z, 3)) do SetWorldItemInteractable(slot.key, false)endSee also
Section titled “See also”IsWorldItemInteractable · GetWorldItemsNear · OnPlayerTakeWorldItem · the Doors and containers group of the index
