Skip to content

Where the ore is

Ore coordinates are not written out by hand: everybody's map is different, and the search is one line

mediumYou need: Mining, Binding by type
tick 0
Unit Bind0
type
Unit Locate1
locateflagenemy?oreout Xout YoutFoundoutBuild
Unit Control2
typexy
Sensor3
=
in
Sensor4
=
in
@counter0number
oreXnullnull
oreYnullnull
foundnullnull
buildingnullnull
cargonullnull
whatnullnull
ubind @mono
ulocate ore core true @copper oreX oreY found building
ucontrol mine oreX oreY 0 0 0

Two lines find copper and send the mono to mine it. On this map the nearest copper lies on tile 12 7 — that is where the unit flies, and cargo starts growing.

Field What is in it when searching for ore
first ore
second a block flag — unused when searching for ore
third “search for an enemy” — also unused
fourth the item: @copper, @lead, @titanium
fifth and sixth where to put the tile’s coordinates
seventh whether it was found
eighth the building — ore has none, emptiness arrives

ulocate has eight fields for all four kinds of search at once, and the spare ones are simply not looked at. The game’s editor shows this plainly: some fields go dim as soon as you choose ore.

tick 0
Unit Bind0
type
Unit Locate1
locateflagenemy?oreout Xout YoutFoundoutBuild
Unit Locate2
locateflagenemy?oreout Xout YoutFoundoutBuild
Stop3
@counter0number
oreXnullnull
oreYnullnull
foundnullnull
buildingnullnull
missXnullnull
missYnullnull
titaniumFoundnullnull
building2nullnull

The same map also has lead — on the other side. The search gives 5 3, because it measures distance from the unit, not from the processor and not from the core.

So two units running the same program fly to different deposits: each to its own nearest one. There is no need to spread them over the map separately.

The search looks for a tile the wanted item is mined from. It looks not only at the overlay — the map layer where ores are drawn — but at the floor itself: a sand floor drops sand, and for the search that is ore like any other.

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.