Skip to content

Set Prop

The other side of sensor: what it reads, setprop writes — bypassing all physics

tick 0
Set Prop0
typeofvalue
Set Prop1
typeofvalue
Unit Bind2
type
Set Prop3
typeofvalue
Sensor4
=
in
Sensor5
=
in
Sensor6
=
in
Stop7
@counter0number
turretHealthnullnull
copperInStorenullnull
whoseDaggernullnull
setprop @health duo1 50
setprop @copper container1 120
setprop @team @unit @crux

Three lines change the world directly: the turret now has 50 health, the store has 120 copper, and the dagger goes over to the enemy. None of that “happens” — it simply becomes so.

Field What is in it
first a property: @health, @team, @x — or an item: @copper
second to whom: a building or a unit
third the new value

The field order is the reverse of sensor’s: there, where to put it first; here, what to change.

Property To whom What it does
@health a building and a unit sets health; will not go above the maximum
@team a building and a unit moves it to another team
@x, @y a unit teleports it across the map
@rotation a unit and a turret turns it
@flag a unit the same flag as ucontrol flag
@totalPower a battery charges it
an item a building puts exactly that much of that item in

An item in the first field is a special case and the most useful one: setprop @copper container1 120 does not add 120 copper but makes it be 120.

setprop deals no damage, carries no items and moves no unit — it substitutes a number. All its quirks follow from that:

  • a building set to zero health dies — as if from damage, but with nobody having dealt it: the battle statistics will not see it;
  • a unit moved by @x and @y ends up anywhere: through walls, beyond the edge of the base, in the middle of water;
  • items placed by setprop come out of nowhere and never pass along a conveyor.

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.