ThinkBudget beta
Class of @v12-engine/engine/ai
export declare class ThinkBudgetThe budget of the think under way, as a module reads it (ai.budget): what this tick may still do, and the way to say what was looked at (spent) and to go on at the next tick (later). A module that walks units looks at them a few at a time:
for (; this.cursor squads.length; this.cursor++) look(squads[this.cursor]) if (!ai.budget.spent(squads[this.cursor].size) && this.cursor + 1 squads.length) return ai.budget.later()
Members
constructor
constructor(options?: number | ThinkBudgetOptions);Constructs a new instance of the ThinkBudget class
deferred
deferred: boolean;Whether the module running asked to go on at the next tick (later)
later
later(): void;The module running stops here for this tick and is run again at the next, going on from where it remembers it was, over the same picture. Honoured where the module looked at something this tick (spent): one that looked at nothing and asks to go on would never end, so it is taken to be done, and the log says so
modulesPerTick
readonly modulesPerTick: number;Modules a tick may run: Infinity where unlimited
report
report(): ThinkBudgetOptions | undefined;The budget as the report shows it: the limits, where there are any
room
get room(): boolean;Whether this tick may look at more: a module that walks units stops where it may not, and says later
slices
get slices(): boolean;Whether the budget may slice a think over ticks at all: one that limits nothing never does, and nothing is kept for it
spent
spent(units?: number): boolean;Says the module looked at so many units (one when left out). Gives whether this tick may look at more: where it may not, a module with more to do remembers where it was and says later
units
units: number;Units looked at this tick, as the modules said (spent)
unitsPerTick
readonly unitsPerTick: number;Units a tick's modules may look at, as they say: Infinity where unlimited
warnAfterMs
readonly warnAfterMs: number | undefined;Milliseconds a module may take before the log says so: none for never