MovementState beta
Interface of @v12-engine/engine
export interface MovementStateWhat a unit keeps of its moving: speed, goal, status and the path's bookkeeping
Members
anchored
anchored: boolean;Whether the unit holds its ground in a fight, so that others come round it
aside
aside?: boolean;On a step aside for another (MoveOptions.aside): it goes round nobody and asks nobody to make way
asideDepth
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
backTries?: number;How many times it went back to its place without getting there: it lets it go after a few
bestDistance
bestDistance: number;Closest the unit has been to its corner, used to detect that it stopped making progress
cap
cap?: number;The fastest it goes for now, whatever its speed: a group's slowest, as it moves together (OrderParams.together)
corner
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
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
detourAim?: Vec2;Where it heads on from detour: the corner of its path it went round the knot towards
detourPast
detourPast?: boolean;Whether it was sent on past detour, towards its path, as it neared it
faces
faces?: EntityId;A unit it keeps facing while it walks, rather than the way it goes (OrderParams.faces): none when left out
finalFacing
finalFacing: number | null;Direction the unit turns to while it stands still. Null when it may face wherever it ended up
formation
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
ghost: boolean;Whether the navigation lets it through others, as a ghost
goal
goal: Vec2;Where it is heading, in cells
goalEntity
goalEntity: EntityId;When set the goal follows this entity
groupId
groupId: number;The group of units that were sent together; the same as the groupId of their order
navGoal
navGoal: Vec2;Last destination handed to the navigation
navVersion
navVersion: number;The version of the navigation when the goal was handed to it
phased
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
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
range: number;Arrive once this close to the goal (edge distance for entity goals)
route
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
routeAt?: number;The corner of route it heads past next
routeVersion
routeVersion?: number;What its side knew when the route was planned (SidePaths.version): it is planned again once that changes
slowTime
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
speed: number;Units per second it goes at now
stalledTime
stalledTime: number;Seconds it has made no progress towards its corner
status
status: MoveStatus;Whether it is idle, on its way, arrived or failed to get there
stretch
stretch?: Vec2;Where along route the navigation was last sent it: a stretch no longer than it can see
stuck
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
triedAt?: number;How far it had left to go when it last tried again
tries
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