Switching on and off
The one command that works on any block: switch it off and switch it back on
A switched-off block does not work: a drill does not drill, a factory does not produce, a conveyor does not carry. Logic uses this constantly — it is its main way of interfering with a base.
The program watches the store and keeps the drill on while there is less than a hundred
copper. Press “run” and wait: as soon as copper reaches 100, running becomes zero and the
drill stops.
The line reads as “enable the block on a condition”
Section titled “The line reads as “enable the block on a condition””control enabled drill1 lowThe third field is not “on” and not “off” but a number: zero switches off, any other value switches on. So what usually goes in there is the result of a comparison:
op lessThan low copper 100control enabled drill1 lowsensor can check the state
Section titled “sensor can check the state”sensor running drill1 @enabledThe @enabled property is read on any block and answers with a one or a zero. That is handy
for debugging: if a block is not working while the program is sure of the opposite, one line
settles the question.
Only linked blocks obey
Section titled “Only linked blocks obey”There are two drills on the map. The first is linked to our processor, the second to a neighbouring one; ours fetches it by the neighbour’s link name and commands both the same way.
Press “run”: mineRuns becomes zero and theirsRuns stays one. The building is real —
sensor reads it perfectly well — but the order does not reach it.
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.