Lootables
constLootables:object
Defined in: server/api.d.ts:4318
Server-owned loot: chests opened with F, moonstone deposits broken with a spell, foragables picked up with F. A take is accepted only from a player the lootable streams to, standing within 25 m of it (150 m of a deposit, which a spell breaks from range), and only up to what they see; it is adopted into their inventory automatically. Who may loot what, respawns and persistence are the gamemode’s: use views and lootableTaken.
Type Declaration
Section titled “Type Declaration”get(
id):LootableState|null
One lootable by id.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”LootableState | null
getView()
Section titled “getView()”getView(
id,player):LootableContents|null
The player’s view, or null when they see the lootable’s own contents.
Parameters
Section titled “Parameters”number
player
Section titled “player”Returns
Section titled “Returns”LootableContents | null
list()
Section titled “list()”list():
LootableState[]
Every server-owned lootable.
Returns
Section titled “Returns”place()
Section titled “place()”place(
kind,x,y?,z?,yaw?,options?):number
Places a lootable for every client and returns its id, 0 on failure. An empty or locked moonstone shows mined out, an empty or locked foragable picked.
Parameters
Section titled “Parameters”"chest" | "moonstone" | "foragable"
number | Vector3Like
number
number
number
options?
Section titled “options?”mode defaults to “shared”. open (chests only) holds the lid as setOpen does; left out, the game moves it. virtualWorld and map place it in that world of that map, as setVirtualWorld does for an entity (default world 0 of the shared map). model is a Blueprint class path; it defaults to a Hogwarts chest, a small moonstone deposit, or the foragable that gives the item. Moonstones take BP_Moonstone_S/M/L and foragables the five shipped foragable Blueprints only. Moonstones and foragables hold plain items only, and a foragable one stack.
items?
Section titled “items?”LootItem[]
locked?
Section titled “locked?”boolean
string
"shared" | "perPlayer"
model?
Section titled “model?”string
boolean
virtualWorld?
Section titled “virtualWorld?”number
Returns
Section titled “Returns”number
remove()
Section titled “remove()”remove(
id):boolean
Removes it from every client.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”boolean
setItems()
Section titled “setItems()”setItems(
id,items):boolean
Replaces what every player without a view sees; an empty list empties it.
Parameters
Section titled “Parameters”number
LootItem[]
Returns
Section titled “Returns”boolean
setLocked()
Section titled “setLocked()”setLocked(
id,locked):boolean
Locks or unlocks it for every player without a view.
Parameters
Section titled “Parameters”number
locked
Section titled “locked”boolean
Returns
Section titled “Returns”boolean
setMode()
Section titled “setMode()”setMode(
id,mode):boolean
Shared: a take empties it for everyone. PerPlayer: a take empties only the taker’s view.
Parameters
Section titled “Parameters”number
"shared" | "perPlayer"
Returns
Section titled “Returns”boolean
setOpen()
Section titled “setOpen()”setOpen(
id,open):boolean
Swings a chest’s lid open (with its open sound) or shut for every player, and holds it there: an empty chest stays shut, and the lid swings back after a player loots it. A chest that streams in shows the lid already there. Throws for a moonstone or foragable.
Parameters
Section titled “Parameters”number
boolean
Returns
Section titled “Returns”boolean
setView()
Section titled “setView()”setView(
id,player,view):boolean
Overrides what one player sees in it. Views last for the connection: a gamemode keeping them across reconnects re-applies them.
Parameters
Section titled “Parameters”number
player
Section titled “player”{ items?: LootItem[]; locked?: boolean; } | null
Fields left out keep the lootable’s own value; null drops the view.
Returns
Section titled “Returns”boolean