atl/sm/ai
import "atl/sm/ai"Helpers for AI units (sm.ai).
Functions
Section titled "Functions"func IsReachable(unit sm.Unit, position sm.Vec3) boolTrue if the unit can walk to position.
func DirectPathAvailable(unit sm.Unit, position sm.Vec3, rng float64) boolTrue if there is a straight unobstructed path within rng.
func AimPosition(character sm.Character, target atl.Wrapper, rng, width float64, attack *int) (sm.Vec3, bool)Where the character should aim to hit target, or false if it can't.
func ClosestVisiblePlayerCharacter(unit sm.Unit) sm.CharacterThe nearest player character the unit can see.
func ClosestVisibleCharacterType(unit sm.Unit, characterType sm.Uuid) sm.CharacterThe nearest visible character of a given type.
func ClosestVisibleTeamOpponent(unit sm.Unit, teamColor sm.Color) sm.CharacterThe nearest visible character not on the given team.
func ClosestVisibleCrop(unit sm.Unit) sm.HarvestableThe nearest visible crop.
func ClosestTree(position sm.Vec3, world sm.World) sm.HarvestableThe nearest tree to a position.
func RandomCreationPosition(body sm.Body) sm.Vec3A random point on a creation's body.
Breach
Section titled "Breach"type Breach struct { Position sm.Vec3 Object sm.Target}A blocking object the unit could break through, and where.
func BreachablePosition(unit sm.Unit, position sm.Vec3, rng float64, attackLevel int) (Breach, bool)Something the unit could break through on the way to position.