Cart
Defined in: server/api.d.ts:3814
Replicated cart or wagon handle.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Cart(
id):Cart
Defined in: server/api.d.ts:3819
Creates a script wrapper for an existing cart with this ID; use Cart.spawn() to spawn one.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Cart
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: server/api.d.ts:3860
Despawns this cart on every client. Everyone in it is let out first, each with a cartExit, then cartDestroy is raised.
Returns
Section titled “Returns”void
getOccupant()
Section titled “getOccupant()”getOccupant(
seat):Player|null
Defined in: server/api.d.ts:3882
Who sits in a seat.
Parameters
Section titled “Parameters”string
One of the cart’s seats.
Returns
Section titled “Returns”Player | null
The player in it, or null when it is empty.
putPlayer()
Section titled “putPlayer()”putPlayer(
player,seat):boolean
Defined in: server/api.d.ts:3868
Puts a player in a seat. They are taken out of any cart they were in, their own game walks them to the seat and climbs in, and cartEnter follows; the driver’s client runs the cart from then on. cartEntering handlers are asked first.
Parameters
Section titled “Parameters”player
Section titled “player”The player to seat.
string
One of the cart’s seats. A wagon has driver (the reins, on the bench’s left), bench (beside them), rightBack, leftBack, rightFront and leftFront (on the rails); the two-wheeler driver, rightBack and leftBack.
Returns
Section titled “Returns”boolean
Whether the player was seated: false for a taken seat, a player that is not connected, or a handler’s refusal.
removePlayer()
Section titled “removePlayer()”removePlayer(
player):boolean
Defined in: server/api.d.ts:3875
Lets a player out of this cart: their own game climbs down, and cartExit is raised.
Parameters
Section titled “Parameters”player
Section titled “player”The player to let out.
Returns
Section titled “Returns”boolean
False when the player is not in this cart.
seatOf()
Section titled “seatOf()”seatOf(
player):string|null
Defined in: server/api.d.ts:3889
Where a player sits in this cart.
Parameters
Section titled “Parameters”player
Section titled “player”The player to look for.
Returns
Section titled “Returns”string | null
The seat’s name, one of seats, or null when they are not in it.
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”teleport()
Section titled “teleport()”teleport(
position,rotation?):boolean
Defined in: server/api.d.ts:3897
Moves the cart outright, standing, with everyone in it; a driver carries on from there.
Parameters
Section titled “Parameters”position
Section titled “position”Where the cart’s front axle stands.
rotation?
Section titled “rotation?”Which way it faces; omitted keeps its heading.
Returns
Section titled “Returns”boolean
False for a pose that is not finite.
toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:3855
Formats this cart handle for logging and debugging.
Returns
Section titled “Returns”string
The cart ID, its blueprint, its driver and its pace.
Inherited from
Section titled “Inherited from”
staticall(virtualWorld?):Cart[]
Defined in: server/api.d.ts:3914
Lists the carts the server has.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to list; omitted lists every one.
Returns
Section titled “Returns”Cart[]
One handle per live cart, in no particular order.
blueprints()
Section titled “blueprints()”
staticblueprints():string[]
Defined in: server/api.d.ts:3934
Names every cart prefab Cart.spawn can build.
Returns
Section titled “Returns”string[]
The blueprint names, in catalog order.
destroyAll()
Section titled “destroyAll()”
staticdestroyAll(virtualWorld?):number
Defined in: server/api.d.ts:3928
Despawns carts, emitting cartDestroy for each one.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to clear; omitted clears every one of them.
Returns
Section titled “Returns”number
How many carts were removed.
getById()
Section titled “getById()”
staticgetById(id):Cart|null
Defined in: server/api.d.ts:3921
Looks a cart up by its network entity ID.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Cart | null
The cart’s handle, or null when no live cart has that ID.
spawn()
Section titled “spawn()”
staticspawn(blueprint?,position?,rotation?,virtualWorld?):Cart
Defined in: server/api.d.ts:3907
Spawns and replicates a cart or wagon from the game’s own prefabs, with its horses already in the shafts. It stands where it was put until somebody takes the reins.
Parameters
Section titled “Parameters”blueprint?
Section titled “blueprint?”string
Which of the game’s cart prefabs to build; omitted builds wagon_b_covered. Cart.blueprints() lists them.
position?
Section titled “position?”Where the cart’s front axle stands; omitted components default to zero.
rotation?
Section titled “rotation?”Which way it faces: a Quaternion, or a Vector3 of Euler angles in degrees.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world the cart belongs to; omitted puts it in the global one.
Returns
Section titled “Returns”Cart
The newly spawned cart handle.
Properties
Section titled “Properties”blueprint
Section titled “blueprint”
readonlyblueprint:string
Defined in: server/api.d.ts:3824
The game prefab this cart was built from, e.g. wagon_b_covered. Cart.blueprints() lists them all.
driver
Section titled “driver”
readonlydriver:Player|null
Defined in: server/api.d.ts:3834
The player at the reins, or null when nobody drives it.
horseCount
Section titled “horseCount”
readonlyhorseCount:number
Defined in: server/api.d.ts:3829
How many horses the cart is harnessed for: 2 for a wagon, 1 for the two-wheeled cart, 0 for wagon_b_covered_empty, whose chassis has nowhere to hitch one and so can be sat in but never pulled.
readonlyid:number
Defined in: server/api.d.ts:8765
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”maxSpeed
Section titled “maxSpeed”maxSpeed:
number
Defined in: server/api.d.ts:3849
The fastest the driver may take it urged on (the trot key held), in metres a second, 0 to 15; 7 by default. Unurged the team trots at 3.6 or this, whichever is less. A value outside the range is ignored.
readonlypace:string
Defined in: server/api.d.ts:3839
How the driver last asked the cart to go: stand, walk, trot or reverse.
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”
readonlyseats:string[]
Defined in: server/api.d.ts:3844
The names of this cart’s seats, the reins first: six on a wagon, three on the two-wheeler.
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.