Skip to content

TaskDef beta ​

Interface of @v12-engine/engine/ai

ts
export interface TaskDef<D extends object = TaskData, M extends object = TaskMemory>

A kind of task (defineTask): what it sends as it begins (start), what it looks at each think (think), and the place it is about (where, for the squads module's regroup and reinforcements and for the report). The squads module runs it with its own regroup, reinforce and retreat around it, but for what it handles itself

Members ​

done ​

ts
done?(ai: Brain, squad: Squad, state: TaskState<D, M>): TaskDone | undefined | false;

Whether it is over, asked each think before think: how it ended, or nothing while it goes on

fighting ​

ts
fighting?: boolean;

Whether a squad on it is in a fight it means to win, which the micro fights for (ai.area(Micro)): yes when left out. No for a task that goes somewhere, looks, stands, gathers or falls back (the kit's move, scout, hold, gather, retreat, and the micro's own flee)

handles ​

ts
handles?: readonly ('retreat' | 'regroup' | 'reinforce')[];

What the squads module leaves to it: a task that regroups in its own way, or retreats never

id ​

ts
id: string;

Unique among the brain's tasks: what a save names it by. The kit's are words (attack); a game's prefixed (ctf.capture)

standing ​

ts
standing?: boolean;

Whether it is a standing duty, going on as long as its squad has it (a hero walking a lane with its waves): never stuck, whatever its phase, for the ends invariant (checkBrain). No when left out

start ​

ts
start(ai: Brain, squad: Squad, state: TaskState<D, M>): void;

Sends what puts the squad on its way: called as the task is given, and again as the squad goes on after a regroup. Sets state.phase

think ​

ts
think(ai: Brain, squad: Squad, state: TaskState<D, M>): void;

Each think, after the squads module looked at the squad: watches how it goes, sends what was lost, squad.finish(done) when it is over

where ​

ts
where?(ai: Brain, squad: Squad, state: TaskState<D, M>): Vec2 | undefined;

The place it is about: where reinforcements are sent, what the report shows. None for a task about no place