Door
Defined in: server/api.d.ts:5554
Replicated handle for one of the level’s own doors.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Door(
id):Door
Defined in: server/api.d.ts:5559
Creates a script wrapper for a door the server already knows; doors are the level’s own and are never spawned.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Door
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”setOpen()
Section titled “setOpen()”setOpen(
open,fromFront?):boolean
Defined in: server/api.d.ts:5628
Opens or closes the door with nobody pushing it. Every client that has the door built plays the game’s own swing; one arriving later finds it posed the same way. Opening a locked door unlocks it, as the game’s own Open does.
Parameters
Section titled “Parameters”boolean
True to open the door, false to close it.
fromFront?
Section titled “fromFront?”boolean
Which side the leaf is worked from, and so which way it swings. Omitted keeps the side it was last worked from.
Returns
Section titled “Returns”boolean
False when the door is already that way.
setVirtualWorld()
Section titled “setVirtualWorld()”setVirtualWorld(
world):void
Defined in: server/api.d.ts:8797
Moves this entity into another virtual world.
Parameters
Section titled “Parameters”number
Virtual-world identifier used to partition replication and visibility.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setVisibleTo()
Section titled “setVisibleTo()”setVisibleTo(
player):void
Defined in: server/api.d.ts:8803
Restricts replication of this entity to one owning connection while preserving normal range and visibility checks.
Parameters
Section titled “Parameters”player
Section titled “player”Entity | null
Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:5620
Formats this door handle for logging and debugging.
Returns
Section titled “Returns”string
The door ID, its level GUID and whether it is open and locked.
Inherited from
Section titled “Inherited from”
staticall():Door[]
Defined in: server/api.d.ts:5634
Lists every door the level places, all of which exist from boot in the global world. In another virtual world a door is built the first time anything there reaches it, so this lists only those.
Returns
Section titled “Returns”Door[]
One handle per known door, in no particular order.
find()
Section titled “find()”
staticfind(guid,virtualWorld?):Door|null
Defined in: server/api.d.ts:5649
Looks a door up by the level’s own identity for it, which survives a restart and is the same on every machine. A door the level places is always found, in any virtual world.
Parameters
Section titled “Parameters”string
The door’s level EntityGuid as hex, with or without an 0x prefix, as door.guid prints it.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to look in; omitted looks in the global one, where every body starts.
Returns
Section titled “Returns”Door | null
The door’s handle, or null when the level places no such door.
getById()
Section titled “getById()”
staticgetById(id):Door|null
Defined in: server/api.d.ts:5641
Looks a door up by its network entity ID.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Door | null
The door’s handle, or null when no live door has that ID.
getForArea()
Section titled “getForArea()”
staticgetForArea(areaId):AreaDoor[]
Defined in: server/api.d.ts:5656
Lists the doors the level links to an area as its crime_doors, with their GUID, name, position and link type, straight from the level catalog – so a door that no client has reported yet is listed too. Pass a guid to Door.find for the live handle and its locked state. Only native links: a script area has none.
Parameters
Section titled “Parameters”areaId
Section titled “areaId”string
The area’s id, as area.id prints it.
Returns
Section titled “Returns”AreaDoor[]
The doors; empty for an unknown area or one with no links.
queryNearest()
Section titled “queryNearest()”
staticqueryNearest(player):Promise<NearestDoor>
Defined in: server/api.d.ts:5665
Asks a player’s client which door their body is standing at. The server knows every door the level places but has no world to measure distances in, so this is how a command finds the door in front of a player, and the answer is what that client sees now rather than what the replica last carried.
The promise always settles: on the answer, on a five-second timeout, or when the player leaves, with found false and reason saying which.
Parameters
Section titled “Parameters”player
Section titled “player”The player to ask. The question goes to their own client.
Returns
Section titled “Returns”Promise<NearestDoor>
The answer, once that client has given one.
Properties
Section titled “Properties”
readonlyareas:Area[]
Defined in: server/api.d.ts:5609
The level areas that link this door as one of their crime_doors – the house, workshop or storage room it belongs to, as the level itself records it. Nothing is inferred from where the door stands.
readonlyguid:string
Defined in: server/api.d.ts:5564
The level’s own EntityGuid, as sixteen lowercase hex digits. The same on every machine, so it is the identity to store a door under; Door.find takes it back.
readonlyid:number
Defined in: server/api.d.ts:8765
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”keyItem
Section titled “keyItem”
readonlykeyItem:string
Defined in: server/api.d.ts:5599
The item class GUID of the key the level assigns to the door’s keyhole, as player.giveItem takes it. Empty when it takes none of its own – most doors open to the generated home or shop key instead. The server does not see inventories, so this is for a resource that keeps its own.
locked
Section titled “locked”locked:
boolean
Defined in: server/api.d.ts:5584
Whether the door is locked. Assignment reaches every client that has the door streamed in, including one already standing at it. A door locked from here can only be opened again from here or with a lockpick: a player unlocking it by hand or with a key is refused.
lockedByServer
Section titled “lockedByServer”
readonlylockedByServer:boolean
Defined in: server/api.d.ts:5589
Whether the lock was set by a script or an operator rather than by the level. It clears when the door is unlocked, by any route the server accepted.
lockpickable
Section titled “lockpickable”
readonlylockpickable:boolean
Defined in: server/api.d.ts:5604
Whether the level lets this door be lockpicked. A lockpick reported on one that cannot be is refused.
readonlyname:string
Defined in: server/api.d.ts:5594
The entity name the level gives the door.
readonlyopen:boolean
Defined in: server/api.d.ts:5574
Whether the door is standing open. Change it with setOpen, which also says which way it swings.
openedFromFront
Section titled “openedFromFront”
readonlyopenedFromFront:boolean
Defined in: server/api.d.ts:5579
Which side the leaf was last worked from, which decides the way it swings. A player arriving later poses the door from this, so everyone sees it swung the same way.
position
Section titled “position”position:
Vector3
Defined in: server/api.d.ts:8775
Authoritative world-space position; assignment forces replicated state.
Inherited from
Section titled “Inherited from”rotation
Section titled “rotation”rotation:
Vector3|Quaternion
Defined in: server/api.d.ts:8780
Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.
Inherited from
Section titled “Inherited from”startsLocked
Section titled “startsLocked”
readonlystartsLocked:boolean
Defined in: server/api.d.ts:5614
Whether the level builds this door locked, which is the state it has at boot.
readonlystate:StateBag
Defined in: server/api.d.ts:8785
Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.
Inherited from
Section titled “Inherited from”stateToken
Section titled “stateToken”
readonlystateToken:number
Defined in: server/api.d.ts:5569
Bumped on every durable change. Clients act on the edges rather than the value, so it only tells one change from the next.
virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:8770
Current virtual-world identifier.