Door
constDoor:object
Defined in: server/api.d.ts:1818
Controls native world doors (building, shop and apartment doors) by door id: their synchronized open and lock state, and whether players can interact with them. A door id is the door’s baked frame hash as a “0x”-prefixed hex string; getCatalog lists every base-game door with its id, and the doorInteract event reports it whenever a player uses a door. Door state is kept per virtual world: a player only sees and changes the doors of their own world, so one interior can serve several worlds. The server-wide interaction default applies to every world.
Type Declaration
Section titled “Type Declaration”getCatalog()
Section titled “getCatalog()”getCatalog():
DoorInfo[]
Lists every door of the base game: building, shop and apartment doors, gates, and also cabinets, fridges and windows, which the game builds the same way.
Returns
Section titled “Returns”DoorInfo[]
Every catalogued door.
getDefaultInteractionEnabled()
Section titled “getDefaultInteractionEnabled()”getDefaultInteractionEnabled():
boolean|null
Returns the server-wide door interaction default.
Returns
Section titled “Returns”boolean | null
True or false when forced, null when doors are left as the game sets them up.
getInteractionEnabled()
Section titled “getInteractionEnabled()”getInteractionEnabled(
doorId,virtualWorld?):boolean|null
Returns a door’s own interaction override in a virtual world.
Parameters
Section titled “Parameters”doorId
Section titled “doorId”string
Door id, a “0x”-prefixed hex string as reported by doorInteract.
virtualWorld?
Section titled “virtualWorld?”number
Virtual world whose door state to use; 0 when omitted.
Returns
Section titled “Returns”boolean | null
True or false when the door is overridden, null when it follows the server-wide default.
getState()
Section titled “getState()”getState(
doorId,virtualWorld?):DoorState
Returns the synchronized state of a door in a virtual world. A door whose state the server does not force follows the game’s own state (some doors stay locked in freeride) and reads closed and unlocked.
Parameters
Section titled “Parameters”doorId
Section titled “doorId”string
Door id, a “0x”-prefixed hex string as reported by doorInteract.
virtualWorld?
Section titled “virtualWorld?”number
Virtual world whose door state to use; 0 when omitted.
Returns
Section titled “Returns”The door’s synchronized state.
reset()
Section titled “reset()”reset(
doorId,virtualWorld?):void
Drops every override on a door in a virtual world: the door returns to the game’s own state, and its interaction follows the server-wide default again.
Parameters
Section titled “Parameters”doorId
Section titled “doorId”string
Door id, a “0x”-prefixed hex string as reported by doorInteract.
virtualWorld?
Section titled “virtualWorld?”number
Virtual world whose door state to use; 0 when omitted.
Returns
Section titled “Returns”void
setDefaultInteractionEnabled()
Section titled “setDefaultInteractionEnabled()”setDefaultInteractionEnabled(
enabled):void
Sets the server-wide interaction default for every door without its own override, in every virtual world.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean | null
True to enable every door, false to disable every door, null to leave each door as the game sets it up.
Returns
Section titled “Returns”void
setInteractionEnabled()
Section titled “setInteractionEnabled()”setInteractionEnabled(
doorId,enabled,virtualWorld?):boolean
Overrides whether players in a virtual world can open, kick, lock or lockpick a door. A door with interaction disabled still follows setState.
Parameters
Section titled “Parameters”doorId
Section titled “doorId”string
Door id, a “0x”-prefixed hex string as reported by doorInteract.
enabled
Section titled “enabled”boolean | null
True to let players use the door, including doors the game’s own scripts keep disabled; false to remove its prompt; null to follow the server-wide default.
virtualWorld?
Section titled “virtualWorld?”number
Virtual world whose door state to use; 0 when omitted.
Returns
Section titled “Returns”boolean
False when the world’s door registry is full.
setState()
Section titled “setState()”setState(
doorId,open,locked?,virtualWorld?):boolean
Forces a door open or closed, locked or unlocked, for every player in the virtual world, including players who stream it in or enter the world later. The forced state holds until reset, including over doors the game keeps locked.
Parameters
Section titled “Parameters”doorId
Section titled “doorId”string
Door id, a “0x”-prefixed hex string as reported by doorInteract.
boolean
True to swing the door open, false to close it.
locked?
Section titled “locked?”boolean
Lock state; keeps the current lock state when omitted.
virtualWorld?
Section titled “virtualWorld?”number
Virtual world whose door state to use; 0 when omitted.
Returns
Section titled “Returns”boolean
False when the world’s door registry is full (256 doors that differ from their default).
