Gate
Defined in: server/api.d.ts:5696
Replicated handle for one of the level’s castle gates.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Gate(
id):Gate
Defined in: server/api.d.ts:5701
Creates a script wrapper for a gate the server already knows; gates are the level’s own and are never spawned.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Gate
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”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”toggle()
Section titled “toggle()”toggle(
open?):GateToggle
Defined in: server/api.d.ts:5749
Starts a cycle. The motion is never streamed: every client plays it out from the server clock it started on, and a gate reversed mid-cycle picks up where it is rather than snapping to the far end.
Parameters
Section titled “Parameters”boolean
true opens, false closes. Omitted heads away from whichever end the gate is at, reversing one already moving.
Returns
Section titled “Returns”What happened, and the phrase to explain it with when nothing did.
toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:5742
Formats this gate handle for logging and debugging.
Returns
Section titled “Returns”string
The gate ID, its level GUID, what kind it is and where it is in its cycle.
Inherited from
Section titled “Inherited from”
staticall():Gate[]
Defined in: server/api.d.ts:5755
Lists every gate the level places, all of which exist from boot in the global world. In another virtual world a gate is built the first time anything there reaches it, so this lists only those.
Returns
Section titled “Returns”Gate[]
One handle per gate, in no particular order.
find()
Section titled “find()”
staticfind(guid,virtualWorld?):Gate|null
Defined in: server/api.d.ts:5770
Looks a gate up by the level’s own identity for it, which survives a restart and is the same on every machine. A gate the level places is always found, in any virtual world.
Parameters
Section titled “Parameters”string
The gate’s level EntityGuid as hex, with or without an 0x prefix, as gate.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”Gate | null
The gate’s handle, or null when the level places no such gate.
getById()
Section titled “getById()”
staticgetById(id):Gate|null
Defined in: server/api.d.ts:5762
Looks a gate up by its network entity ID.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Gate | null
The gate’s handle, or null when no live gate has that ID.
nearest()
Section titled “nearest()”
staticnearest(position,radius,virtualWorld?):Gate|null
Defined in: server/api.d.ts:5779
Finds the gate nearest a point. Gate positions come from the level’s own data, so unlike a door this needs no round trip to anybody’s client.
Parameters
Section titled “Parameters”position
Section titled “position”World-space point to measure from.
radius
Section titled “radius”number
How far to look, in metres. Castle architecture is visible from a long way off, so this is tens of metres rather than a couple.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to look in; omitted looks in the global one.
Returns
Section titled “Returns”Gate | null
The nearest gate within the radius, or null when there is none.
Properties
Section titled “Properties”closeDuration
Section titled “closeDuration”
readonlycloseDuration:number
Defined in: server/api.d.ts:5736
How long closing takes, in seconds, from the asset’s animation database.
readonlycycle:string
Defined in: server/api.d.ts:5716
Where the gate is in its cycle: closed, opening, open or closing. Open always means passable – a portcullis raised, a drawbridge lowered. Named cycle because every entity already has a state, which is its state bag.
readonlyguid:string
Defined in: server/api.d.ts:5706
The level’s own EntityGuid, as sixteen lowercase hex digits. The same on every machine, so it is the identity to store a gate under; Gate.find takes it back. A gate has no entity of its own, so its key is the GUID of the layer that draws it shut.
readonlyid:number
Defined in: server/api.d.ts:8765
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”
readonlykind:string
Defined in: server/api.d.ts:5711
What piece of architecture this is: drawbridge or portcullis, which animate, or gate, a pair of leaves the level swaps between drawn open and drawn shut – the Ratborsch and Nebakov fortress gates and the Ruthard palace gate. A gate opens and closes at once.
moving
Section titled “moving”
readonlymoving:boolean
Defined in: server/api.d.ts:5726
Whether a cycle is running. toggle reverses a moving gate from where it has got to rather than refusing it.
openDuration
Section titled “openDuration”
readonlyopenDuration:number
Defined in: server/api.d.ts:5731
How long opening takes, in seconds, from the key range the asset’s animation database stores. A gate with no opening clip runs its closing one backwards, so this is that clip’s length. 0 for a gate.
openness
Section titled “openness”
readonlyopenness:number
Defined in: server/api.d.ts:5721
How far open the gate is, from 0 shut to 1 fully open, read off the pose curve mined from the asset’s own animation at the point the server clock says the motion has reached. It follows the bars, not the clock: a portcullis reads 0 within the first fifth of its close, and holds there while the clip finishes.
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”
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”virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:8770
Current virtual-world identifier.