Skip to content

FormationDef beta ​

Interface of @v12-engine/engine

ts
export interface FormationDef

How units ordered to a point together are laid out around it (OrderInit.formation, RuleSettings.movement.formation): a shape, which the engine fits the units to, or the places themselves. The engine's own are rows, circle, square and none (coreFormations); a game adds its own (Rules.formations), and changes any laid out with the formation hook

Members ​

id ​

ts
id: string;

The formation's id, which an order names it by

name ​

ts
name: string;

What the player sees it called

points ​

ts
points?(context: FormationContext): Map<EntityId, Vec2>;

The places themselves, by the unit's id, when the shape is not enough: one that goes by who the units are, or where they stand. A unit given none goes to the target itself. Over shape where both are given

shape ​

ts
shape?(count: number, spacing: number, context: FormationContext): Vec2[];

The shape, as count places spacing apart, in the formation's own space: x to the right, z forward, the first places at the front. Units are fitted to them so that their ways cross as little as can be (fitToPlaces): those ahead to the places at the front