Skip to content

Set Block

Editing the map on the fly: a block appears instantly, with no construction, no resources and no queue

tick 0
Set Block0
layerblockxyteamrotation
Set Block1
layerblockxyteamrotation
Set Block2
layerblockxyteamrotation
Set Block3
layerblockxyteamrotation
Get Block4
layerresultxy
Get Block5
layerresultxy
Get Block6
layerresultxy
Get Block7
layerresultxy
Stop8
@counter0number
floornullnull
orenullnull
wallnullnull
removednullnull
setblock floor @metal-floor 6 4 @sharded 0
setblock ore @ore-titanium 6 4 @sharded 0
setblock block @copper-wall 8 4 @sharded 0
setblock block @air 12 4 @sharded 0

Four lines change the map: the floor turns metal, titanium ore appears on top of it, a copper wall grows beside it — and the router on tile 12 4 disappears.

Field What is in it
first the layer: floor, ore or block
second what to place: a block constant or @air
third and fourth the tile’s coordinates
fifth the team — only for the block layer
sixth rotation, 0 to 3 — for conveyors and drills

There is no separate “remove” instruction: you put air into a layer and whatever was there disappears. No rubble, no refund, no animation.

Ore is cleared the same way: setblock ore @air 6 4 clears the overlay, leaving the floor.

setblock floor @router will not put a router on the floor and will not make a router-floor. It simply does nothing — silently, like almost everything in mlog.

Layer What it accepts
floor floors only: @sand-floor, @metal-floor, @water
ore ores and overlays only: @ore-copper, @air
block anything buildable, plus natural walls and @air

setblock has no building layer at all: a structure cannot be placed that way, only a block — and its structure appears by itself.

Coordinates are truncated here and rounded next door

Section titled “Coordinates are truncated here and rounded next door”
tick 0
Set Block0
layerblockxyteamrotation
Get Block1
layerresultxy
Get Block2
layerresultxy
Stop3
@counter0number
wherePlacednullnull
sameNumbersnullnull

Here is the non-obvious part, and it is not a liberty of ours but the game’s behaviour:

setblock block @copper-wall 7.9 4.9 @sharded 0
getblock block sameNumbers 7.9 4.9

The wall goes onto tile 7 4 — the fractional part is dropped. And getblock, given the very same numbers, looks at tile 8 5, because it rounds. The result: the program does not find the wall it has just placed.

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.