GroundItem
Defined in: server/api.d.ts:5130
Replicated world stack handle.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GroundItem(
id):GroundItem
Defined in: server/api.d.ts:5135
Creates a script wrapper for an existing ground item with this ID; use GroundItem.spawn() to spawn one.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”GroundItem
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: server/api.d.ts:5191
Takes this stack back out of the world on every client after emitting groundItemDestroy.
Returns
Section titled “Returns”void
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”toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:5186
Formats this ground item handle for logging and debugging.
Returns
Section titled “Returns”string
The stack ID, its item class, how many of it there are and whether it has settled.
Inherited from
Section titled “Inherited from”
staticall():GroundItem[]
Defined in: server/api.d.ts:5209
Lists every stack lying in the world, however it got there.
Returns
Section titled “Returns”GroundItem[]
One handle per live stack, in no particular order.
destroyAll()
Section titled “destroyAll()”
staticdestroyAll(virtualWorld?):number
Defined in: server/api.d.ts:5223
Removes stacks from the world, emitting groundItemDestroy 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 stacks were removed.
getById()
Section titled “getById()”
staticgetById(id):GroundItem|null
Defined in: server/api.d.ts:5216
Looks a stack up by its network entity ID.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”GroundItem | null
The stack’s handle, or null when no live stack has that ID.
spawn()
Section titled “spawn()”
staticspawn(item,position?,rotation?,amount?,virtualWorld?,properties?):GroundItem
Defined in: server/api.d.ts:5203
Lays a pickable stack of an item on the ground and replicates it, spawning it already at rest.
Parameters
Section titled “Parameters”string
Item class to lay down, as either its GUID or its name (arrow_crude). The same spelling player.giveItem takes.
position?
Section titled “position?”Optional world-space spawn position; omitted components default to zero. The stack is placed there rather than dropped, so put it where the ground is.
rotation?
Section titled “rotation?”Optional resting orientation: a Quaternion, or a Vector3 of Euler angles in degrees.
amount?
Section titled “amount?”number
Optional number of units in the stack, from 1 to 10000; omitted lays down one. A stack is picked up whole.
virtualWorld?
Section titled “virtualWorld?”number
Optional virtual world the stack belongs to; omitted puts it in the global one.
properties?
Section titled “properties?”Optional condition of the item itself: quality as the game grades it, health and condition from 0 to 1. Each defaults to the class’s own. Arrows and other missile classes are held to tighter bounds by the receiving client and are given a quality of 1 and full health when these are left out, since a stack outside those bounds is one no client would build. carryable makes it a prop people carry in their arms rather than stock: the game’s pick-up prompt over it starts a carry (raising playerCarryingItem) and never puts it in an inventory. Only for a single item player.carryItem takes by name.
carryable?
Section titled “carryable?”boolean
condition?
Section titled “condition?”number
health?
Section titled “health?”number
quality?
Section titled “quality?”number
Returns
Section titled “Returns”GroundItem
The newly spawned ground item handle. Throws when the item is not a class in the game’s tables, or when no client could build the stack as described.
Properties
Section titled “Properties”amount
Section titled “amount”
readonlyamount:number
Defined in: server/api.d.ts:5145
How many units are in the stack. One entity however many that is: a stack is picked up whole or not at all.
carryable
Section titled “carryable”
readonlycarryable:boolean
Defined in: server/api.d.ts:5170
Whether this is a prop people carry in their arms – one a carry put down, or one spawned carryable – rather than stock. Taking it up is a carry: the game’s pick-up prompt or player.carryItem(groundItem), never an inventory.
condition
Section titled “condition”
readonlycondition:number
Defined in: server/api.d.ts:5160
Displayed condition from 0 to 1, or -1 when it was left to the class’s own.
droppedBy
Section titled “droppedBy”
readonlydroppedBy:Player|null
Defined in: server/api.d.ts:5180
The player who dropped this stack, or null when the server spawned it or that player has since left.
droppedById
Section titled “droppedById”
readonlydroppedById:number
Defined in: server/api.d.ts:5175
Network ID of the player who dropped this stack, or 0 when the server spawned it.
health
Section titled “health”
readonlyhealth:number
Defined in: server/api.d.ts:5155
Absolute item health from 0 to 1, or -1 when it was left to the class’s own.
readonlyid:number
Defined in: server/api.d.ts:8765
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”itemClass
Section titled “itemClass”
readonlyitemClass:string
Defined in: server/api.d.ts:5140
The class of item lying here, as the same 32 hex digits player.rightHandItem and player.equipment use, so the three can be compared directly. The server holds no name for a class: naming one is an item database’s job.
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”quality
Section titled “quality”
readonlyquality:number
Defined in: server/api.d.ts:5150
Quality the stack was made with, or 0 when it was left to the class’s own.
resting
Section titled “resting”
readonlyresting:boolean
Defined in: server/api.d.ts:5165
Whether the stack has settled where it will stay. A stack a script spawned is resting from the start; one a player dropped is false while the nearest client simulates its fall, and its position moves until then. A resting stack’s pose is the server’s and does not move again.
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.