Skip to main content

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

FieldType
SignatureWorld.id → string
Returnsstring — same value as world.name (the protocol has no separate world id)

world.name

FieldType
SignatureWorld.name → string
Returnsstring — uppercased world name (e.g. "PIXELSTATION")

world:size()

FieldType
Signature(self: World) → Vec2i
ReturnsVec2i — world dimensions in tiles (x = WIDTH, y = HEIGHT)
Asyncyes

world:entrance()

FieldType
Signature(self: World) → Vec2i
ReturnsVec2i — spawn point as a tile coordinate (WorldStartPoint, except TUTORIAL2 which always returns the sleeping-pod tile)
Asyncyes
world.id
world.name
world:size()
world:entrance()

Tiles

world:tile(point)

FieldType
Signature(self: World, point: Vec2i) → Tile?
ReturnsTile?nil when the world snapshot isn't ready yet (e.g. mid-warp). OOB coordinates land on a sentinel tile with all layers zero
Asyncyes

world:tiles()

FieldType
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
Asyncyes
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)

FieldType
Signature(self: World, blockType: number) → {Vec2i}
Returns{Vec2i} — 1-indexed list of every foreground tile whose id matches blockType. Empty table when no hits
Asyncyes

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)

FieldType
Signature(self: World, uid: string) → Player?
ReturnsPlayer?nil when nobody by that uid is in the world (or the local player matches and is excluded)
Asyncyes

world:players()

FieldType
Signature(self: World) → {[string]: Player}
Returns{[string]: Player} — map of every other player keyed by userid (NOT 1-indexed). Local player not included
Asyncyes
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)

FieldType
Signature(self: World, id: number) → Collectable?
ReturnsCollectable?nil when no collectable with that server-side CollectableID exists in the world
Asyncyes

world:collectables()

FieldType
Signature(self: World) → {[number]: Collectable}
Returns{[number]: Collectable} — map of every loose collectable keyed by id
Asyncyes
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)

FieldType
Signature(self: World, id: number) → Enemy?
ReturnsEnemy?nil when no AI with that id is tracked. Same id passed to client:hitEnemy(x, y, aiId)
Asyncyes

world:enemies()

FieldType
Signature(self: World) → {[number]: Enemy}
Returns{[number]: Enemy} — map of every tracked AI enemy keyed by aiId
Asyncyes
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()

FieldType
Signature(self: World) → Growscan
ReturnsGrowscan — aggregate harvest projection across every growing tile and loose collectable. Use :tiles() / :collectables() to read rows
Asyncyes

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