Skip to content
M2O Scripting APIScripting reference
Global objectServer APIGenerated

Door

const Door: 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.

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.

DoorInfo[]

Every catalogued door.

getDefaultInteractionEnabled(): boolean | null

Returns the server-wide door interaction default.

boolean | null

True or false when forced, null when doors are left as the game sets them up.

getInteractionEnabled(doorId, virtualWorld?): boolean | null

Returns a door’s own interaction override in a virtual world.

string

Door id, a “0x”-prefixed hex string as reported by doorInteract.

number

Virtual world whose door state to use; 0 when omitted.

boolean | null

True or false when the door is overridden, null when it follows the server-wide default.

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.

string

Door id, a “0x”-prefixed hex string as reported by doorInteract.

number

Virtual world whose door state to use; 0 when omitted.

DoorState

The door’s synchronized state.

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.

string

Door id, a “0x”-prefixed hex string as reported by doorInteract.

number

Virtual world whose door state to use; 0 when omitted.

void

setDefaultInteractionEnabled(enabled): void

Sets the server-wide interaction default for every door without its own override, in every virtual world.

boolean | null

True to enable every door, false to disable every door, null to leave each door as the game sets it up.

void

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.

string

Door id, a “0x”-prefixed hex string as reported by doorInteract.

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.

number

Virtual world whose door state to use; 0 when omitted.

boolean

False when the world’s door registry is full.

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.

string

Door id, a “0x”-prefixed hex string as reported by doorInteract.

boolean

True to swing the door open, false to close it.

boolean

Lock state; keeps the current lock state when omitted.

number

Virtual world whose door state to use; 0 when omitted.

boolean

False when the world’s door registry is full (256 doors that differ from their default).