LootSpots
constLootSpots:object
Defined in: server/api.d.ts:4454
The game’s own Overland moonstone deposits and foragables under World.setLootPolicy(“server”): every spot the game spawns, as a lootable streamed to the players near it. A take empties it (for everyone, or under “perPlayer” for the taker) and is adopted into the taker’s inventory; it restocks after its kind’s respawn time. Spots are not Lootables: Lootables.list() leaves them out. Settings and depletion last for the server’s run. Event: lootSpotTaken(player, spotId, items).
Type Declaration
Section titled “Type Declaration”
readonlymode:"shared"|"perPlayer"
“shared” (the default: a take empties the spot for everyone) or “perPlayer” (a take empties it for the taker only).
get(
id):LootSpotState|null
One spot, or null for an unknown id.
Parameters
Section titled “Parameters”string
A spot id from getAll.
Returns
Section titled “Returns”LootSpotState | null
getAll()
Section titled “getAll()”getAll():
LootSpotState[]
Every spot in the catalog, whether its family runs or not.
Returns
Section titled “Returns”getKinds()
Section titled “getKinds()”getKinds():
LootSpotKind[]
Every kind of spot with its current yield and respawn time.
Returns
Section titled “Returns”getLootableId()
Section titled “getLootableId()”getLootableId(
id):number
The Lootables id the spot is placed as, for Lootables.setView or Lootables.get; it changes each time the spot is placed again.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number
0 while it is not placed, or for an unknown id.
reset()
Section titled “reset()”reset(
id):boolean
Restocks a spot now, for every player.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
False for an unknown id.
setEnabled()
Section titled “setEnabled()”setEnabled(
id,enabled):boolean
Takes one spot out of the world or puts it back, stocked. Lasts for the server’s run: a gamemode keeping a list re-applies it at startup.
Parameters
Section titled “Parameters”string
enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”boolean
False for an unknown id.
setMode()
Section titled “setMode()”setMode(
mode):boolean
Sets what a take empties. A change restocks every spot; under “perPlayer” each player’s spot comes back after the respawn time from their own take.
Parameters
Section titled “Parameters”"shared" | "perPlayer"
Returns
Section titled “Returns”boolean
False for any other value.
setRespawnSeconds()
Section titled “setRespawnSeconds()”setRespawnSeconds(
seconds,kind?):boolean
Sets how long an emptied spot stays empty. The default, 4320, is the game’s own 3 in-game days at the default time scale; it does not follow World.setTimeScale. A spot already waiting keeps its time.
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number
0 to a week.
string
A kind name, “moonstones” or “foragables”; every kind when left out.
Returns
Section titled “Returns”boolean
False for an unknown kind or a value out of range.
setYield()
Section titled “setYield()”setYield(
count,kind?):boolean
Sets how many of its item a spot holds when it restocks. Stocked spots keep what they hold until their next restock.
Parameters
Section titled “Parameters”number | [number, number]
A whole number, or a min and max rolled at each restock (1 to 1000).
string
A kind name, “moonstones” or “foragables”; every kind when left out.
Returns
Section titled “Returns”boolean
False for an unknown kind or a count out of range.