Skip to content

Mining

Not everyone mines and not everything is minable, and they mine from where they stand — reaching the tile is the unit's own problem

tick 0
Unit Bind0
type
Unit Control1
typexy
Sensor2
=
in
Sensor3
=
in
Sensor4
=
in
@counter0number
cargonullnull
whatnullnull
miningnullnull
ubind @mono
ucontrol mine 9 4 0 0 0

The mono reaches the ore with a beam and starts mining: mining becomes one, cargo grows, what shows copper. In about nine seconds the unit gathers its twenty — no more will fit — and the mining stops by itself.

Field What is in it
first mine
second and third the tile with ore, not an item
the rest unused

The fields hold coordinates, not an item: a unit mines a particular tile, not “copper in general”. ulocate ore can find such a tile: it gives the coordinates of the nearest ore of the kind you want.

Not everyone mines and not everything is minable

Section titled “Not everyone mines and not everything is minable”

Every unit has a mining tier and every ore a hardness. Ore harder than the tier — and the order silently does nothing:

Unit Tier What it takes Cargo slots
Mono 1 sand, scrap, copper, lead 20
Poly 2 and coal as well 30
Mega 3 and titanium as well 60
Dagger, flare none nothing

Ore hardness: sand and scrap are zero, copper and lead one, coal two, titanium three, thorium four. A unit takes everything no harder than its tier, and thorium on that list goes to nobody: it needs tier four.

When the cargo is full, mining stops. The unit stays where it is until somebody unloads it — it will not fly anywhere by itself.

So a mining program is always a pair of “mine — deliver”:

ubind @mono
sensor cargo @unit @totalItems
jump 5 greaterThanEq cargo 20
ucontrol mine 9 4 0 0 0
end
ucontrol move 4 4 0 0 0
ucontrol itemDrop container1 20 0 0 0

While the hold is not full — mine; once it is — fly to the store and hand over. There is no need to give a “stop mining” order: a movement command cancels it by itself.

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.