Doors
constDoors:object
Defined in: server/api.d.ts:3714
Server-held door state. Every client applies it on arrival and again whenever a matching door streams in, whatever that player’s save says; a key or Alohomora on a held-locked door is refused and raises doorUnlockRequest.
Type Declaration
Section titled “Type Declaration”allowUnlock()
Section titled “allowUnlock()”allowUnlock(
player,selector):boolean
Lets one player open the lock held under a selector with their game’s own key or Alohomora: the wand cast and the lockpicking minigame play out, and a press it refused moments ago is pressed again for them. Once they open it the server releases that lock for everyone, as Doors.set(selector, { locked: false }) does, and doorUnlocked fires with shared true; abandoned, the door stays locked. Lasts 60 seconds or until used. False when the selector holds no lock or the player is not connected.
Parameters
Section titled “Parameters”player
Section titled “player”selector
Section titled “selector”string
Returns
Section titled “Returns”boolean
clear()
Section titled “clear()”clear(
selector):boolean
Releases one selector. Its doors keep their current state until they restream into each player’s own save.
Parameters
Section titled “Parameters”selector
Section titled “selector”string
Returns
Section titled “Returns”boolean
clearAll()
Section titled “clearAll()”clearAll():
number
Releases every selector; returns how many were held.
Returns
Section titled “Returns”number
get(
selector):DoorState|null
The state held under one selector.
Parameters
Section titled “Parameters”selector
Section titled “selector”string
Returns
Section titled “Returns”DoorState | null
getShareUnlocks()
Section titled “getShareUnlocks()”getShareUnlocks():
boolean
Whether locks players open are shared with everyone.
Returns
Section titled “Returns”boolean
list()
Section titled “list()”list():
DoorState[]
Every held door state.
Returns
Section titled “Returns”set(
selector,state):boolean
Holds a door’s lock, open state and/or lock level for every player. The selector is an actor name, a persistent id ‘
Parameters
Section titled “Parameters”selector
Section titled “selector”string
Returns
Section titled “Returns”boolean
setShareUnlocks()
Section titled “setShareUnlocks()”setShareUnlocks(
share):void
Whether a lock a player opens by key or Alohomora is held unlocked for everyone, under the door’s persistent id (the default), or stays open only in their game. doorUnlocked fires either way.
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void