Skip to content

Get Block

A tile has not one content but four layers. getblock asks about any of them

tick 0
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 4
getblock ore ore 9 4
getblock block wall 12 4
getblock building building 6 7

One instruction and four different questions to the map. On this map it answers: metal floor, copper ore, stone wall and a router.

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:

  • block gives a type: @router, @copper-wall, @stone-wall. That is content, not a structure on the map — it has to be compared with block constants;
  • building gives the structure itself: the same thing getlink gives. It can be asked for health, stock and team.
getblock building store 6 7
sensor copperLeft store @copper

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.

A world processor reads tiles for the sake of a script:

  • check whether the player built what was asked: getblock building on 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.