WorkshopItem
Defined in: server/api.d.ts:2993
An object built in a settlement, by a player or a script, linked to a workbench the data files place. It lasts the whole session, whoever built it, until a player scraps or stores it or a script destroys it. Setting position or angle moves it for everyone.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WorkshopItem(
id):WorkshopItem
Defined in: server/api.d.ts:2998
Wraps an existing built object with this ID; it builds nothing. See WorkshopItem.place.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”WorkshopItem
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
boolean
Defined in: server/api.d.ts:3019
Takes the object out of the settlement for everyone; nobody gets its components back.
Returns
Section titled “Returns”boolean
True when it was there to take.
getSpace()
Section titled “getSpace()”getSpace():
PlayerSpace|null
Defined in: server/api.d.ts:3031
Where the object stands.
Returns
Section titled “Returns”PlayerSpace | null
The worldspace or interior cell, or null once it is gone.
setVirtualWorld()
Section titled “setVirtualWorld()”setVirtualWorld(
world):void
Defined in: server/api.d.ts:4292
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:4298
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:3025
Formats this handle for logging.
Returns
Section titled “Returns”string
The object’s network ID, form and workbench.
Inherited from
Section titled “Inherited from”
staticall(workbench?):WorkshopItem[]
Defined in: server/api.d.ts:3050
Every object built this session.
Parameters
Section titled “Parameters”workbench?
Section titled “workbench?”string | number
Only the objects of this workbench.
Returns
Section titled “Returns”WorkshopItem[]
One handle per object.
place()
Section titled “place()”
staticplace(form,workbench,position,space,angle?,wire?):WorkshopItem|null
Defined in: server/api.d.ts:3043
Builds an object for everyone, as if a player had at that workbench. Nothing is checked: not the recipe, its cost nor the buildable area. A wire is laid out between its two ends on every client once both are loaded, and linked into their power grid.
Parameters
Section titled “Parameters”string | number
The base object to build.
workbench
Section titled “workbench”string | number
The workbench reference it belongs to, placed by the data files.
position
Section titled “position”Where it stands.
The worldspace, or the interior cell: exactly one of the two.
interiorCell?
Section titled “interiorCell?”string | number
worldSpace?
Section titled “worldSpace?”string | number
angle?
Section titled “angle?”Its rotation, radians.
For a wire (the game’s workshop spline), the two objects it joins: a built object, or a placed reference’s form ID, each with the connect point the wire takes on it (0 by default).
string | number | WorkshopItem
fromPoint?
Section titled “fromPoint?”number
string | number | WorkshopItem
toPoint?
Section titled “toPoint?”number
Returns
Section titled “Returns”WorkshopItem | null
The object, or null when it could not be created.
Properties
Section titled “Properties”angle:
Vector3
Defined in: server/api.d.ts:3013
Its rotation, radians, as the game stores it. Assigning turns it for everyone.
readonlyform:number
Defined in: server/api.d.ts:3003
The base object’s form ID; 0 once it is gone.
readonlyid:number
Defined in: server/api.d.ts:4260
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”position
Section titled “position”position:
Vector3
Defined in: server/api.d.ts:4270
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:4275
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:4280
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:4265
Current virtual-world identifier.
Inherited from
Section titled “Inherited from”workbench
Section titled “workbench”
readonlyworkbench:number
Defined in: server/api.d.ts:3008
The workbench reference it belongs to; 0 once it is gone.