SquadGroup beta
Class of @v12-engine/engine/ai
export declare class SquadGroup implements Iterable<Squad>Some squads together (ai.squads.all(), idle()): read as a list, told as one (ai.squads.all().defend(home): each squad is given the task)
Members
[Symbol.iterator]
[Symbol.iterator](): Iterator<Squad>;Iterates the squads, so that the set reads as a list
constructor
constructor(
ai: Brain,
squads: readonly Squad[]);Constructs a new instance of the SquadGroup class
ai
readonly ai: Brain;The brain they are of
attack
attack(target: Vec2 | EntityState | number, options?: {
avoid?: 'army' | false;
then?: TaskOrder;
}): this;Tells each squad to attack a point, an entity or an entity id, as Squad.attack does, and returns the set
defend
defend(at: Vec2 | undefined, radius?: number): this;Tells each squad to defend a place within a radius as Squad.defend does; does nothing without a place; returns the set
disband
disband(why?: string): void;Each disbanded
hold
hold(at?: Vec2): this;Tells each squad to hold at a place, or where it is, as Squad.hold does, and returns the set
length
get length(): number;How many squads
move
move(at: Vec2): this;Tells each squad to move to a point as Squad.move does, and returns the set
retreat
retreat(to?: Vec2): this;Tells each squad to retreat to a point, or home when left out, as Squad.retreat does, and returns the set
squads
readonly squads: readonly Squad[];The squads
strength
strength(): number;How strong they are together
task
task<D extends object, M extends object>(def: TaskDef<D, M>, data: D & TaskCommon): this;Each given the same task
task
task(kind: string, data?: TaskData): this;Gives each squad the same task, by its kind and data, and returns the set
units
units(): UnitSet;Their units together, as a set