SmartObject
Defined in: server/api.d.ts:6414
A bench, a bed, a dice table, an alchemy table, a smithy, a drying rack or a smokehouse a script or a World Builder export placed. Every player in its virtual world can sit on it, sleep in it or work at it as they would at the level’s own. It never moves: assigning position or rotation, or calling setVirtualWorld, is put back on the next tick.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SmartObject(
id):SmartObject
Defined in: server/api.d.ts:6419
Wraps a smart object the server already holds; use SmartObject.spawn to place one.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”SmartObject
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: server/api.d.ts:6460
Takes the smart object down for every player. A player sitting on it or working at it is let go.
Returns
Section titled “Returns”void
setVirtualWorld()
Section titled “setVirtualWorld()”setVirtualWorld(
world):void
Defined in: server/api.d.ts:9890
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:9896
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”toJSON()
Section titled “toJSON()”toJSON():
SmartObjectDefinition|null
Defined in: server/api.d.ts:6466
The definition SmartObject.spawn takes to place it again: what a script saves. The server keeps nothing past a restart. It is one entry of a World Builder map’s smartObjects array.
Returns
Section titled “Returns”SmartObjectDefinition | null
Null once it is gone.
toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:6455
Formats this handle for logging and debugging.
Returns
Section titled “Returns”string
Its id, blueprint and kind.
Inherited from
Section titled “Inherited from”
staticall(virtualWorld?):SmartObject[]
Defined in: server/api.d.ts:6481
Lists the smart objects scripts and World Builder exports placed.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to list; omitted lists every one.
Returns
Section titled “Returns”SmartObject[]
One handle per placed object, in no particular order.
blueprints()
Section titled “blueprints()”
staticblueprints():SmartObjectBlueprintInfo[]
Defined in: server/api.d.ts:6494
Lists everything SmartObject.spawn can place.
Returns
Section titled “Returns”One row per blueprint, sorted by name.
getById()
Section titled “getById()”
staticgetById(id):SmartObject|null
Defined in: server/api.d.ts:6488
Looks a placed smart object up by its network entity ID.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”SmartObject | null
The handle, or null.
remove()
Section titled “remove()”
staticremove(id,virtualWorld?):void
Defined in: server/api.d.ts:6509
Takes one of the level’s stations out of a virtual world through a level edit on its entity: listed nowhere, refused for any new session by the server (one already running at it finishes), and hidden on every client seeing that world – a player in the global world sees every world. The furniture around it is the level’s own scenery and stays; take it out with LevelEdit.apply or the World Builder. A placed smart object goes with destroy() instead. Kept in memory only, like every level edit.
Parameters
Section titled “Parameters”string
The level station’s GUID, as SmartObject.stations() lists it.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to take it out of; the global one, and so every world, when omitted.
Returns
Section titled “Returns”void
Throws for an id that is not one of the level’s stations.
removed()
Section titled “removed()”
staticremoved(virtualWorld?):RemovedStation[]
Defined in: server/api.d.ts:6524
Lists the level’s stations a level edit has taken out, by a script or a World Builder export alike.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to list; omitted lists every one.
Returns
Section titled “Returns”One row per removal, in no particular order.
restore()
Section titled “restore()”
staticrestore(id,virtualWorld?):boolean
Defined in: server/api.d.ts:6517
Puts back one of the level’s stations that a level edit took out of a virtual world.
Parameters
Section titled “Parameters”string
The level station’s GUID, as SmartObject.removed() lists it.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to put it back in; the global one when omitted.
Returns
Section titled “Returns”boolean
False when that world had no such removal.
spawn()
Section titled “spawn()”
staticspawn(definition,virtualWorld?):SmartObject
Defined in: server/api.d.ts:6474
Places one of the game’s interactive prefabs – its furniture, solid, and the entities its interaction runs on – for every player in the virtual world, built on each client under the same GUIDs, so sitting on it and working at it replicate as they do at the level’s own. A placed dice table, crafting station, drying rack or smokehouse joins Dice.tables(), Crafting.stations() and the server’s checks like the level’s own. Kept in memory only: place it again on boot. The resource that places it owns it, so it goes when that resource stops. NPCs do not use it. A bare definition places the entities without the furniture, where a prop of your own stands.
Parameters
Section titled “Parameters”definition
Section titled “definition”What to place and where, in the format of one entry of a World Builder map’s smartObjects array.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world whose players see it; the global one when omitted.
Returns
Section titled “Returns”SmartObject
The smart object. Throws for an unknown blueprint, a transform that is not finite, or bare on a blueprint that cannot stand bare.
stations()
Section titled “stations()”
staticstations(virtualWorld?):SmartObjectStation[]
Defined in: server/api.d.ts:6501
Lists every station players in a virtual world can use: the level’s dice tables, crafting stations, drying racks and smokehouses, minus any a level edit took out of that world, and every placed one there or in the global world.
Parameters
Section titled “Parameters”virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world to list for; the global one when omitted.
Returns
Section titled “Returns”One row per station, in no particular order.
Properties
Section titled “Properties”
readonlybare:boolean
Defined in: server/api.d.ts:6439
Whether it was placed without its blueprint’s furniture: only the place a body takes, or the station, and the prompts that offer it.
blueprint
Section titled “blueprint”
readonlyblueprint:string
Defined in: server/api.d.ts:6424
The blueprint it was placed from, as SmartObject.blueprints() lists it.
readonlyid:number
Defined in: server/api.d.ts:9858
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”
readonlykind:"alchemy"|"smithing"|"seat"|"bed"|"dice"|"drying"|"smoking"
Defined in: server/api.d.ts:6429
What it is for.
readonlyname:string
Defined in: server/api.d.ts:6434
The name it was placed with; empty for none.
position
Section titled “position”position:
Vector3
Defined in: server/api.d.ts:9868
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:9873
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:6449
The GUIDs of the places a body sits or lies on, as a seated player’s stance and DiceTableInfo.seats name them.
readonlystate:StateBag
Defined in: server/api.d.ts:9878
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”stationId
Section titled “stationId”
readonlystationId:string
Defined in: server/api.d.ts:6444
The GUID of its station part as sixteen lowercase hex digits: the id Dice.tables() and SmartObject.stations() give it. Crafting.stations() lists an alchemy table or a smithy as <level>:<stationId>. Empty for a seat or a bed. It lasts only until the server stops.
virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:9863
Current virtual-world identifier.