Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classServer APIGenerated

GroundItem

Defined in: server/api.d.ts:5130

Replicated world stack handle.

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.

number

Network entity identifier.

GroundItem

Entity.constructor

destroy(): void

Defined in: server/api.d.ts:5191

Takes this stack back out of the world on every client after emitting groundItemDestroy.

void


setVirtualWorld(world): void

Defined in: server/api.d.ts:8797

Moves this entity into another virtual world.

number

Virtual-world identifier used to partition replication and visibility.

void

Entity.setVirtualWorld


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.

Entity | null

Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.

void

Entity.setVisibleTo


toString(): string

Defined in: server/api.d.ts:5186

Formats this ground item handle for logging and debugging.

string

The stack ID, its item class, how many of it there are and whether it has settled.

Entity.toString


static all(): GroundItem[]

Defined in: server/api.d.ts:5209

Lists every stack lying in the world, however it got there.

GroundItem[]

One handle per live stack, in no particular order.


static destroyAll(virtualWorld?): number

Defined in: server/api.d.ts:5223

Removes stacks from the world, emitting groundItemDestroy for each one.

number

Optional virtual world to clear; omitted clears every one of them.

number

How many stacks were removed.


static getById(id): GroundItem | null

Defined in: server/api.d.ts:5216

Looks a stack up by its network entity ID.

number

Network entity identifier.

GroundItem | null

The stack’s handle, or null when no live stack has that ID.


static spawn(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.

string

Item class to lay down, as either its GUID or its name (arrow_crude). The same spelling player.giveItem takes.

Vector3 | Partial<Vector3>

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.

Vector3 | Quaternion

Optional resting orientation: a Quaternion, or a Vector3 of Euler angles in degrees.

number

Optional number of units in the stack, from 1 to 10000; omitted lays down one. A stack is picked up whole.

number

Optional virtual world the stack belongs to; omitted puts it in the global one.

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.

boolean

number

number

number

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.

readonly amount: 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.


readonly carryable: 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.


readonly condition: 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.


readonly droppedBy: 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.


readonly droppedById: number

Defined in: server/api.d.ts:5175

Network ID of the player who dropped this stack, or 0 when the server spawned it.


readonly health: 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.


readonly id: number

Defined in: server/api.d.ts:8765

Immutable network entity identifier.

Entity.id


readonly itemClass: 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: Vector3

Defined in: server/api.d.ts:8775

Authoritative world-space position; assignment forces replicated state.

Entity.position


readonly quality: 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.


readonly resting: 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: 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.

Entity.rotation


readonly state: 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.

Entity.state


readonly virtualWorld: number

Defined in: server/api.d.ts:8770

Current virtual-world identifier.

Entity.virtualWorld