World
The world handle is the bot's snapshot of the current map: tiles, players in the same world, loose drops, AI mobs, growing crops. Every accessor awaits a fresh snapshot from the bot session, so consecutive calls see live data without an explicit refresh.
local world = getClient():world() -- or getWorld()
Identity
world.id
| Field | Type |
|---|---|
| Signature | World.id → string |
| Returns | string — same value as world.name (the protocol has no separate world id) |
world.name
| Field | Type |
|---|---|
| Signature | World.name → string |
| Returns | string — uppercased world name (e.g. "PIXELSTATION") |
world:size()
| Field | Type |
|---|---|
| Signature | (self: World) → Vec2i |
| Returns | Vec2i — world dimensions in tiles (x = WIDTH, y = HEIGHT) |
| Async | yes |
world:entrance()
| Field | Type |
|---|---|
| Signature | (self: World) → Vec2i |
| Returns | Vec2i — spawn point as a tile coordinate (WorldStartPoint, except TUTORIAL2 which always returns the sleeping-pod tile) |
| Async | yes |
world.id
world.name
world:size()
world:entrance()
Tiles
world:tile(point)
| Field | Type |
|---|---|
| Signature | (self: World, point: Vec2i) → Tile? |
| Returns | Tile? — nil when the world snapshot isn't ready yet (e.g. mid-warp). OOB coordinates land on a sentinel tile with all layers zero |
| Async | yes |
world:tiles()
| Field | Type |
|---|---|
| Signature | (self: World) → {Tile}? |
| Returns | {Tile}? — flat 1-indexed array, row-major, width * height entries long. nil when the world snapshot isn't ready yet |
| Async | yes |
local tile = world:tile(Vector2i.new(5, 5))
for tileIndex, tile in pairs(world:tiles()) do
tile.foreground
tile.background
tile.water
tile.wire
tile.point
local item = tile:item()
if item then
for k, v in pairs(item) do print("{}: {}", k, v) end
end
local tree = tile:tree()
if tree then
tree.point
tree.blockType
tree.mixed
tree:ready()
end
end
world:findTiles(blockType)
| Field | Type |
|---|---|
| Signature | (self: World, blockType: number) → {Vec2i} |
| Returns | {Vec2i} — 1-indexed list of every foreground tile whose id matches blockType. Empty table when no hits |
| Async | yes |
Fast index scan — useful for locating gemstones, chests, portals, etc.
for i, point in ipairs(world:findTiles(9)) do -- 9 = Soil
print(point.x, point.y)
end
Players
world:player(uid)
| Field | Type |
|---|---|
| Signature | (self: World, uid: string) → Player? |
| Returns | Player? — nil when nobody by that uid is in the world (or the local player matches and is excluded) |
| Async | yes |
world:players()
| Field | Type |
|---|---|
| Signature | (self: World) → {[string]: Player} |
| Returns | {[string]: Player} — map of every other player keyed by userid (NOT 1-indexed). Local player not included |
| Async | yes |
local p = world:player("userId")
for userId, p in pairs(world:players()) do
p.id
p.name
p.position
p.level
end
Collectables
world:collectable(id)
| Field | Type |
|---|---|
| Signature | (self: World, id: number) → Collectable? |
| Returns | Collectable? — nil when no collectable with that server-side CollectableID exists in the world |
| Async | yes |
world:collectables()
| Field | Type |
|---|---|
| Signature | (self: World) → {[number]: Collectable} |
| Returns | {[number]: Collectable} — map of every loose collectable keyed by id |
| Async | yes |
local c = world:collectable(collectableId)
for id, c in pairs(world:collectables()) do
c.id
c.amount
c.position
c.blockType
c.inventoryType
c.isGem
c.gemType
end
AI enemies
world:enemy(id)
| Field | Type |
|---|---|
| Signature | (self: World, id: number) → Enemy? |
| Returns | Enemy? — nil when no AI with that id is tracked. Same id passed to client:hitEnemy(x, y, aiId) |
| Async | yes |
world:enemies()
| Field | Type |
|---|---|
| Signature | (self: World) → {[number]: Enemy} |
| Returns | {[number]: Enemy} — map of every tracked AI enemy keyed by aiId |
| Async | yes |
local e = world:enemy(enemyId)
for id, e in pairs(world:enemies()) do
e.id
e.type
e.direction
e.behavior
e.position
e.velocity
e.parent
end
Growscan
world:growscan()
| Field | Type |
|---|---|
| Signature | (self: World) → Growscan |
| Returns | Growscan — aggregate harvest projection across every growing tile and loose collectable. Use :tiles() / :collectables() to read rows |
| Async | yes |
Aggregates harvestable trees and ground drops by (blockType, inventoryType):
local g = world:growscan()
for i, pair in pairs(g:tiles()) do
print("{} {} x{}", pair.blockType, pair.inventoryType, pair.amount)
end
for i, pair in pairs(g:collectables()) do
print("{} {} x{}", pair.blockType, pair.inventoryType, pair.amount)
end
Harvest example
Walk to every ready tree and chop it.
local client = getClient()
local world = client:world()
local function harvestable(tile)
local tree = tile:tree()
return tree ~= nil and tree:ready()
end
local function tryHarvest(tile)
while harvestable(tile) do
if not client:point():equals(tile.point) then
if not client:findPath(tile.point) then return end
while client:pathfinding() do sleep(100) end
else
client:hit(tile.point)
sleep(200)
end
end
end
for i, tile in pairs(world:tiles()) do
tryHarvest(tile)
end