Skip to content

Properties of buildings

Ask a linked block for a number — how much is inside, how much fits, whether it is intact

A container stands next to the processor with 120 copper and 40 lead inside. The processor knows nothing about that — until it asks.

The sensor block has three fields: on the left, where to put the answer; then what to ask; and after the “in” label, who to ask.

Since version 160 the game translates the labels in the blocks. The book button above the example turns them back to English — then that same label reads in, as in other people’s guides and in old videos.

tick 0
Sensor0
=
in
Sensor1
=
in
Sensor2
=
in
Sensor3
=
in
@counter0number
everythingnullnull
limitnullnull
healthnullnull
kindnullnull

Press “step” four times: the values appear one at a time, a line per press.

What is what here

@totalItemsthe property

The list is closed: there are 77 of them and you cannot invent a new one — only pick from the ready ones, which is what the pencil by the field is for.

container1who we ask

That is the name of the link: the first linked container. The game gives the name and it cannot be changed, but it can be put into a variable and passed on.

everythingwhere we put it

This one is your own name, and it can be anything at all. Other people’s programs tend to use short English words, but that does not change the language.

The variable’s name is yours; the names the game has already taken are read-only — that conversation belongs to the set group.

A building and its type are different things

Section titled “A building and its type are different things”

container1 is a building: that container, right there, with that copper in it. There may be twenty of them on the map, each with its own contents and its own health.

@container is a type: one record for the whole game of what a container is like in general. How much fits in it, what it costs, what size it is.

The last line of the example asks the building what type it is and puts into kind not the word “container” but the type itself — the same object as the constant @container. That is why the result of @type is compared with the constant: in a jump block you put the variable on the left and pick @container on the right with the same pencil you used for the property.

This is how you check what kind of block you got: getlink walks the links, sensor @type asks what it is, and the program decides what to do with it.

The type itself can be asked things too: sensor @container @itemCapacity says how much fits into any container.

A container takes two tiles by two, and sensor container1 @x gives 6.5, not 6: the coordinate is the building’s centre, and the centre of an even-sized block falls on the seam between tiles. A router of size 1 never has this.

It is not a detail to shrug at: the half cannot be rounded away “for tidiness” — that coordinate is later used to lead a unit or place a block, and the building’s centre is where it is.

You can ask anything, but a block will not answer everything: a container has no ammo, and sensor container1 @ammo gives null — not zero, and those are different things. Who has which properties at all is the group’s last lesson.

The full list of what can be asked is in the property table.

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.