Skip to content

MovementState beta ​

Interface of @v12-engine/engine

ts
export interface MovementState

What a unit keeps of its moving: speed, goal, status and the path's bookkeeping

Members ​

anchored ​

ts
anchored: boolean;

Whether the unit holds its ground in a fight, so that others come round it

aside ​

ts
aside?: boolean;

On a step aside for another (MoveOptions.aside): it goes round nobody and asks nobody to make way

asideDepth ​

ts
asideDepth?: number;

On a step aside asked by one stepping aside itself: how far down that line it is (2, 3). One that far asks nobody aside in turn, so that a crowd parts a few deep and no further

backTries ​

ts
backTries?: number;

How many times it went back to its place without getting there: it lets it go after a few

bestDistance ​

ts
bestDistance: number;

Closest the unit has been to its corner, used to detect that it stopped making progress

cap ​

ts
cap?: number;

The fastest it goes for now, whatever its speed: a group's slowest, as it moves together (OrderParams.together)

corner ​

ts
corner: Vec2;

Corner of the path the unit is heading for. Progress is measured towards it, so a long way round is not mistaken for standing still

detour ​

ts
detour?: Vec2;

The point it goes round standing units by, on its way to the next corner of its path, when that is not much longer (RuleSettings.movement.goesAround, the detour hook): none while it goes straight

detourAim ​

ts
detourAim?: Vec2;

Where it heads on from detour: the corner of its path it went round the knot towards

detourPast ​

ts
detourPast?: boolean;

Whether it was sent on past detour, towards its path, as it neared it

faces ​

ts
faces?: EntityId;

A unit it keeps facing while it walks, rather than the way it goes (OrderParams.faces): none when left out

finalFacing ​

ts
finalFacing: number | null;

Direction the unit turns to while it stands still. Null when it may face wherever it ended up

formation ​

ts
formation?: number;

The group of the formation it was last sent in (OrderInit.formation, the order's groupId): those of one swap places on the way, and keep the places they get to (place)

ghost ​

ts
ghost: boolean;

Whether the navigation lets it through others, as a ghost

goal ​

ts
goal: Vec2;

Where it is heading, in cells

goalEntity ​

ts
goalEntity: EntityId;

When set the goal follows this entity

groupId ​

ts
groupId: number;

The group of units that were sent together; the same as the groupId of their order

ts
navGoal: Vec2;

Last destination handed to the navigation

ts
navVersion: number;

The version of the navigation when the goal was handed to it

phased ​

ts
phased?: boolean;

Whether a buff it carries has it walk through others now (BuffDef.phasing): a ghost to the navigation as well, whatever ghost says. Seen to every tick by the movement

place ​

ts
place?: Vec2;

Its place in its formation, once there. Stepped aside or pushed off it, it walks back once it has stood off it a while. None once it walks off on a move of its own, or is given another order

range ​

ts
range: number;

Arrive once this close to the goal (edge distance for entity goals)

route ​

ts
route?: Vec2[];

The route its side planned to the goal, corner by corner, with what the side knows (Rules.paths: 'seen'): walked a stretch at a time. None where routes know everything, or there is no route

routeAt ​

ts
routeAt?: number;

The corner of route it heads past next

routeVersion ​

ts
routeVersion?: number;

What its side knew when the route was planned (SidePaths.version): it is planned again once that changes

slowTime ​

ts
slowTime?: number;

Seconds it has gone well under its speed on its way, held up by others (not counting getting going, or slowing to arrive): what has those in its way asked to step aside (see RuleSettings.movement.lookAhead)

speed ​

ts
speed: number;

Units per second it goes at now

stalledTime ​

ts
stalledTime: number;

Seconds it has made no progress towards its corner

status ​

ts
status: MoveStatus;

Whether it is idle, on its way, arrived or failed to get there

stretch ​

ts
stretch?: Vec2;

Where along route the navigation was last sent it: a stretch no longer than it can see

stuck ​

ts
stuck?: boolean;

Whether the last move failed by getting stuck on the way (in a crowd, say), not for there being no way there

triedAt ​

ts
triedAt?: number;

How far it had left to go when it last tried again

tries ​

ts
tries?: number;

How many times it tried again on this move, held up 3 seconds by others that may yet go (in a crowd, say): sent on anew, round the whole knot, those in it asked aside. It gives up after 4, or none when what holds it up is the ground or those holding their ground. Counted again once it gets 2 cells nearer