Function dijkstraMultiroomDistanceMap

  • Create a distance map for the given start positions, using Dijkstra's algorithm to factor in terrain costs (0-255, where 255 is impassable).

    This calculates a distance map across multiple rooms, with a few configurable limits:

    • maxOps: The maximum number of pathfinding operations to perform.
    • maxRooms: The maximum number of rooms to explore.
    • maxPathCost: Don't explore tiles with a greater path cost than this.

    At least one of these limits must be set.

    Parameters

    • start: RoomPosition[]

      The starting positions.

    • options: {
          allOfDestinations?: { pos: RoomPosition; range: number }[];
          anyOfDestinations?: { pos: RoomPosition; range: number }[];
          costMatrixCallback: (room: string) => undefined | ClockworkCostMatrix;
          maxOps?: number;
          maxPathCost?: number;
          maxRooms?: number;
      }

      The options for the distance map.

    Returns {
        distanceMap: ClockworkMultiroomDistanceMap;
        foundTargets: RoomPosition[];
        ops: number;
    }

    A multi-room distance map.