Fetch
A radar sees around itself, query sees an area. Fetch sees everything a team has on the map
fetch unitCount ourUnits @sharded 0 0fetch buildCount turrets @sharded 0 @duofetch core core @sharded 0 0Three questions to the map: how many units we have (two), how many duos (also two) and where
the core is. Distance has nothing to do with it — fetch sees the whole map at once.
| Field | What is in it |
|---|---|
| first | what to get: unit, build, core or their counters |
| second | where to put it |
| third | the team |
| fourth | the index in the list, counting from zero |
| fifth | a type filter: a block for build, a unit type for unit |
Eight kinds and two questions
Section titled “Eight kinds and two questions”The kinds split in half: half give the object itself by index, half give how many there are.
| Gives an object | Gives a number |
|---|---|
unit |
unitCount |
build |
buildCount |
core |
coreCount |
player |
playerCount |
Hence the usual shape of a walk: ask for the count first, then go through the indices.
fetch unitCount amount @sharded 0 0set index 0fetch unit unit @sharded index 0sensor health unit @healthop add index index 1jump 2 lessThan index amountThe order and its fragility
Section titled “The order and its fragility”The list runs in order of appearance: whatever was built or created earlier comes earlier in the list. The indices in it are attached to nobody: let the unit with index 3 die and everything after it shifts by one.
How it differs from radar and query
Section titled “How it differs from radar and query”radar |
query |
fetch |
|
|---|---|---|---|
| where it looks | around a building | in an area of the map | across the whole map |
| what it gives | one | everybody in the area | one by index, or a count |
| who can use it | everyone | a world processor | a world processor |
| finds buildings | no | yes | yes |
fetch is the only way to ask “how many units does the enemy have at all” or “where is their
core” without walking the map tile by tile.
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.