Set Block
Editing the map on the fly: a block appears instantly, with no construction, no resources and no queue
setblock floor @metal-floor 6 4 @sharded 0setblock ore @ore-titanium 6 4 @sharded 0setblock block @copper-wall 8 4 @sharded 0setblock block @air 12 4 @sharded 0Four 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 |
Removal is @air
Section titled “Removal is @air”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.
The layer and the content have to match
Section titled “The layer and the content have to match”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”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 0getblock block sameNumbers 7.9 4.9The 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.