Skip to content

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.

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

boolean, string - true; or false and why not

-- the merchant's wares on show: nobody walks off with them
for _, slot in ipairs(GetWorldItemsNear(STALL_X, STALL_Y, STALL_Z, 3)) do
SetWorldItemInteractable(slot.key, false)
end

IsWorldItemInteractable · GetWorldItemsNear · OnPlayerTakeWorldItem · the Doors and containers group of the index