TileItem

Methods
10
Fields
4

Getting one

scene:groundItems():nearest()
scene:tileAt(…):getItemLayer():getTop()
scene:tileAt(…):getItemLayer():getMiddle()

Methods

MethodReturnsDescription
getId()numberThe item id.
getQuantity()numberHow many.
getVisibleTime()numberThe tick it becomes visible to other players at, on the client:getTickCount() clock.
getDespawnTime()numberThe tick it despawns at, on the client:getTickCount() clock.
getOwnership()numberWho owns it: OWNERSHIP_NONE, _SELF, _OTHER or _GROUP.
isPrivate()booleanWhether only its owner can see it.
getTile()TileThe tile it lies on. The handle is keyed by it, so an item from scene:groundItems() can say where it is.
isPresent()booleanWhether the item is still on the floor: Bento's, for code that keeps handles (a picked-up item's handle answers its last values).
interact(string)booleanAct on the item through the virtual mouse: option is one of its ground actions ("Take"; "" for "Take"). The scheduler resolves THIS sta…
target()booleanUse what this plugin selected on this stack (its id and its tile). Once per selection, and only after one of this plugin's that admits a gr…

Fields

FieldTypeDescription
OWNERSHIP_NONEnumberNo one owns it.
OWNERSHIP_SELFnumberThe local player owns it.
OWNERSHIP_OTHERnumberAnother player owns it.
OWNERSHIP_GROUPnumberThe local player's group owns it.

Returned by

MethodReturnsDescription
GroundItemQuery.collect{ TileItem }Every survivor, nearest first. Consumes the query.
GroundItemQuery.nearestTileItem?The nearest survivor. Consumes the query.
ItemDespawned.getItemTileItemThe item.
ItemLayer.getBottomTileItem?The third item drawn, if any.
ItemLayer.getMiddleTileItem?The second item drawn, if any (the next most valuable of another id).
ItemLayer.getTopTileItem?The most valuable item, drawn first (walk the rest with Tile:getGroundItems()).
ItemQuantityChanged.getItemTileItemThe item.
ItemSpawned.getItemTileItemThe item.
Tile.getGroundItems{TileItem}?Its floor items, nil when there are none: the most valuable (the item layer's top) first; the rest in the client's value order, least val…

Method details

getVisibleTime

getVisibleTime: (TileItem) -> number

The tick it becomes visible to other players at, on the client:getTickCount() clock.

getDespawnTime

getDespawnTime: (TileItem) -> number

The tick it despawns at, on the client:getTickCount() clock.

getTile

getTile: (TileItem) -> Tile

The tile it lies on. The handle is keyed by it, so an item from scene:groundItems() can say where it is.

isPresent

isPresent: (TileItem) -> boolean

Whether the item is still on the floor: Bento's, for code that keeps handles (a picked-up item's handle answers its last values).

interact

interact: (TileItem, string) -> boolean

Act on the item through the virtual mouse: option is one of its ground actions ("Take"; "" for "Take"). The scheduler resolves THIS stack (its id and its tile in its world view, the GROUND_ITEM_*_OPTION entry), moves the virtual mouse and clicks; a nearer item with a similar name is never taken instead, and nothing is clicked when the stack is gone by then. false when the item is gone or outside the views Bento acts on (on another player's boat), or it has no definition.

target

target: (TileItem) -> boolean

Use what this plugin selected on this stack (its id and its tile). Once per selection, and only after one of this plugin's that admits a ground item (Telekinetic Grab, an item's "Use"); nothing is clicked when the stack is gone by the time the click fires. inventory:useOnGroundItem and magic:castOnGroundItem are the select and the use in one call. false when it has no such selection, or the item is gone or outside the top level and the boat the player stands in.