Item
Defined in: server/api.d.ts:1861
A loose item in the world: one a player dropped or a script spawned. Picking it up destroys it, after which the handle reads nothing. Setting position moves it for everyone.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Item(
id):Item
Defined in: server/api.d.ts:1866
Wraps an existing item with this ID; it spawns nothing. See Item.spawn.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Item
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
boolean
Defined in: server/api.d.ts:1882
Takes the item out of the world for everyone.
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:1894
Where the item lies.
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:1888
Formats this handle for logging.
Returns
Section titled “Returns”string
The item’s network ID, form and count.
Inherited from
Section titled “Inherited from”
staticall():Item[]
Defined in: server/api.d.ts:1911
Every loose item in the world.
Returns
Section titled “Returns”Item[]
One handle per item.
spawn()
Section titled “spawn()”
staticspawn(form,count,position,space,angle?):Item|null
Defined in: server/api.d.ts:1905
Puts a loose item in the world, which any player can pick up. It does not fall: it stays where it is put.
Parameters
Section titled “Parameters”string | number
The base object.
number
How many, 1 to 1000000.
position
Section titled “position”Where it lies.
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.
Returns
Section titled “Returns”Item | null
The item, or null when it could not be created.
Properties
Section titled “Properties”
readonlycount:number
Defined in: server/api.d.ts:1876
How many the stack holds; 0 once it is gone.
readonlyform:number
Defined in: server/api.d.ts:1871
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.