Skip to content

atl/sm/ai

import "atl/sm/ai"

Helpers for AI units (sm.ai).

func IsReachable(unit sm.Unit, position sm.Vec3) bool

True if the unit can walk to position.

func DirectPathAvailable(unit sm.Unit, position sm.Vec3, rng float64) bool

True 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.Character

The nearest player character the unit can see.

func ClosestVisibleCharacterType(unit sm.Unit, characterType sm.Uuid) sm.Character

The nearest visible character of a given type.

func ClosestVisibleTeamOpponent(unit sm.Unit, teamColor sm.Color) sm.Character

The nearest visible character not on the given team.

func ClosestVisibleCrop(unit sm.Unit) sm.Harvestable

The nearest visible crop.

func ClosestTree(position sm.Vec3, world sm.World) sm.Harvestable

The nearest tree to a position.

func RandomCreationPosition(body sm.Body) sm.Vec3

A random point on a creation's body.

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.