-
-
Notifications
You must be signed in to change notification settings - Fork 6
Therapist
Vilsol edited this page Jan 26, 2022
·
2 revisions
A simple program that makes @mega
units a little less suicidal.
While there are no buildings to heal, all @mega
units will be homed to the current processor location.
Helps when @mega
units keep running into the enemy lasers.
package main
import "github.com/Vilsol/go-mlog/m"
func main() {
m.UnitBind("@mega")
x, y, _, building := m.UnitLocateDamaged()
health := m.Sensor(building, "@health")
maxHealth := m.Sensor(building, "@maxHealth")
if health == maxHealth {
print("Home")
m.UnitApproach(m.ThisXf, m.ThisYf, 10)
} else {
print("Heal")
m.UnitApproach(float64(x), float64(y), 20)
m.UnitTarget(float64(x), float64(y), true)
}
m.PrintFlush("message1")
}