mwg API
    Preparing search index...

    Type Alias MoveRouteStep

    MoveRouteStep:
        | { dir: Direction4 }
        | { dir: "random" }
        | { dir: "forward" | "backward" }
        | { dir: "toward" | "away" } & RouteTarget
        | { step: { dx: number; dy: number } }
        | { turn: Direction4 | "random" }
        | { turn: "around" | "left90" | "right90" }
        | { turn: "toward" | "away" } & RouteTarget
        | { jump: { dx: number; dy: number } }
        | { wait: number }

    One step of a MoveRoute, run in order against a GridMover. Unlike GridMover.moveBy itself, a route step does not always know its own dx/dy up front - random, toward and away resolve a direction only when the runner actually reaches that step, against wherever the mover and (for toward/away) the target happen to be at that moment.

    Type Declaration

    • { dir: Direction4 }
    • { dir: "random" }
    • { dir: "forward" | "backward" }

      one tile along (or against) the way the mover currently faces

    • { dir: "toward" | "away" } & RouteTarget
    • { step: { dx: number; dy: number } }

      a step of any size and direction, diagonals included; canMove is asked with the same dx/dy

    • { turn: Direction4 | "random" }
    • { turn: "around" | "left90" | "right90" }

      a quarter or half turn from the way the mover currently faces

    • { turn: "toward" | "away" } & RouteTarget
    • { jump: { dx: number; dy: number } }
    • { wait: number }