yolkbot
    Preparing search index...

    Class PathGraph

    The walkable graph for a map: everywhere the player can stand, and how to get between those places. Built once per map by probing a ColliderSet with the player's own collision sphere, so the graph is a consequence of the real geometry rather than of block names - a prop you can walk over produces nodes, and a prop you cannot does not, without anything having to classify it.

    Building is the expensive part of navigation and takes a moment on a large map, so a Pathfinder only does it the first time something actually asks for a route.

    Index

    Constructors

    Methods

    Properties

    Constructors

    Methods

    • Every node standing in a cell column, ordered from the ground up.

      The bounds check is load-bearing, not defensive: column keys are packed into a single number, so a lookup that runs off one edge of the map would otherwise wrap around and quietly answer with a column on the opposite side - which is how a bot ends up being told it can jump a gap the width of the map.

      Parameters

      • cx: number

        The column X

      • cz: number

        The column Z

      Returns PathNode[]

      The nodes in that column, or nothing if it is off the map

    • Finds the node closest to a position, preferring nodes the player could actually be standing on

      Parameters

      • position: Position

        The position to snap

      • radius: number = 3

        How many cells sideways to look

      Returns PathNode | null

      The nearest node, or null if the position is nowhere near the walkable map

    • Searches for the cheapest route between two nodes.

      Plenty of the map is one-way - a standing jump clears about two thirds of a block, so any ledge you drop off is a ledge you cannot climb back up. Rather than refusing to move at all when the destination is on the wrong side of one, the search falls back to the closest place it did manage to reach and says so.

      Parameters

      Returns PathResult

      The route, flagged as partial if the destination could not actually be reached

    Properties

    buildTime: number = 0

    How long the graph took to build, in milliseconds

    colliders: ColliderSet

    The geometry the graph was probed out of

    nodes: PathNode[] = []

    Every node in the graph