GroundItem

A stack of items lying in the world, which all players see as a stack the game lets them pick up. When a player picks it up, the units enter their inventory and the stack goes for everyone. Items dropped from an inventory and arrows or bolts that land also become ground items.

groundItem.spawn()

GroundItem.spawn(item, position = {}, orientation = {}, amount = 1, dimension = GLOBAL_WORLD, properties = {},)

Lays a stack in the world. A worn class with no ground model, where Items.model gives '', such as DLC badges that only pin to a cap, throws a TypeError, since the game would draw nothing.

groundItem.all()

GroundItem.all()

All ground items.

groundItem.getById()

GroundItem.getById(id)

The stack with this network id, or null.

groundItem.destroyAll()

GroundItem.destroyAll(dimension)

Removes all stacks, or those in one dimension, and returns how many.

groundItem.position

position

Its location.

groundItem.rotation

rotation

Its rotation.

groundItem.resting

resting

Whether the stack has stopped. A stack starts where it was spawned or dropped, and the game's physics lets it fall and roll. The first game in view to see it stop reports the spot, and from then on it lies there on all clients, with `position` and `rotation` at that spot, and groundItemResting fires. Until then it is false, including while no player is near enough. A landed arrow or bolt is at rest from the start.

groundItem.leftBy

leftBy

The player who dropped it, or null.

groundItem.visibleTo

visibleTo

The one player who sees it, or null if everyone does.

groundItem.showOnlyTo()

showOnlyTo(player)

Shows the stack to one player, whose game alone lays it and who alone can take it. null shows it to everyone again. Throws a TypeError for anything except a connected Player or null. If that player leaves, nobody sees it until it is shown to someone else.

groundItem.destroy()

destroy()

Removes the stack, firing groundItemDestroy.

groundItem.id

id: number

The network id.

groundItem.itemClass

itemClass: string

The item class, as 32 hex digits.

groundItem.amount

amount: number

The units in the stack.

groundItem.quality

quality: number

The units' quality.

groundItem.health

health: number

The units' condition, as health.

groundItem.carryable

carryable: boolean

Whether it is carried in the arms rather than picked up into the inventory.

groundItem.dimension

dimension: number

Its dimension.

groundItem.name

name: string

The name from GroundItem.spawn's properties, for finding it again, or ''.