Get Block
A tile has not one content but four layers. getblock asks about any of them
mediumYou need: What a world processor is, Number, object and text
Get Block0
layerresultxy
Get Block1
layerresultxy
Get Block2
layerresultxy
Get Block3
layerresultxy
Get Block4
layerresultxy
Get Block5
layerresultxy
Get Block6
layerresultxy
Stop7
@counter0number
floornullnull
orenullnull
wallnullnull
blocknullnull
buildingnullnull
emptynullnull
noOrenullnull
getblock floor floor 6 4getblock ore ore 9 4getblock block wall 12 4getblock building building 6 7One instruction and four different questions to the map. On this map it answers: metal floor, copper ore, stone wall and a router.
The four layers of a tile
Section titled “The four layers of a tile”| Layer | What it gives | What can be there |
|---|---|---|
floor |
the floor | sand, stone, metal floor, water |
ore |
the overlay | ore on top of the floor, or @air if there is none |
block |
what stands there | a building, a static wall or @air |
building |
the building as an object | the block itself, the kind sensor works with |
The difference between block and building is subtle but important:
blockgives a type:@router,@copper-wall,@stone-wall. That is content, not a structure on the map — it has to be compared with block constants;buildinggives the structure itself: the same thinggetlinkgives. It can be asked for health, stock and team.
getblock building store 6 7sensor copperLeft store @copperAn empty tile is @air
Section titled “An empty tile is @air”This is worth checking whenever the coordinates are computed rather than written as numbers: a program walking a strip of the map will certainly go past the edge one day.
Why read the map
Section titled “Why read the map”A world processor reads tiles for the sake of a script:
- check whether the player built what was asked:
getblock buildingon a given tile and a type comparison; - watch territory: is the enemy wall still standing, has the core been demolished;
- find a spot to build on: is it empty, and is the floor suitable;
- give a “build here” objective: a marker on the map plus a tile check.
Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.