Skip to content

Other teams' units

An enemy unit cannot be driven — neither by type nor by object. Looking at it is free

tick 0
Unit Bind0
type
Set1
=
Unit Bind2
type
Set3
=
Sensor4
=
in
Stop5
@counter0number
theirsnullnull
minenullnull
teamnullnull

There are two daggers on the map, both hostile. ubind @dagger honestly searches — and puts emptiness into @unit: the walk goes through units of your own team, and there are no enemies on that list at all.

The same goes for binding by object: even if an enemy unit is sitting in one of your variables — found by a radar, say — ubind will not take it.

The ban covers driving only. Nobody stops you looking at an enemy:

What With what
find the nearest radar from a building, uradar from your own unit
walk through all of them fetch by team, query by area — both on a world processor
read properties sensor — health, coordinates, type, team
shoot at it control shootp on a turret
aim your own unit at it ucontrol targetp — the target is given to yours, not to theirs
radar enemy any any distance duo1 1 foe
sensor health foe @health
sensor team foe @team

An enemy unit here is an ordinary value: it is read, compared, passed around. Only one thing is forbidden — putting it into @unit and commanding it.

sensor whose unit @team gives the team’s number, not the team itself: derelict is zero, yours is usually one, the enemy’s is two.

The constants @sharded, @crux, @derelict, on the other hand, are objects, and they do not compare with a number directly. The number is asked of the team itself:

sensor whose unit @team
sensor crux @crux @id
jump 10 equal whose crux

A processor learns its own team the same way, through itself: sensor myTeam @this @team.

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.