UNPKG

screeps-cartographer

Version:

An advanced (and open source) movement library for Screeps

46 lines (45 loc) 1.91 kB
/// <reference types="screeps" /> import { MoveTarget } from '..'; /** * Position is an edge tile */ export declare const isExit: (pos: RoomPosition) => boolean; /** * Takes a target or list of targets in a few different possible formats and * normalizes to a list of MoveTarget[] */ export declare const normalizeTargets: (targets: RoomPosition | RoomPosition[] | _HasRoomPosition | MoveTarget | MoveTarget[], keepTargetInRoom?: any, flee?: any) => MoveTarget[]; /** * If a MoveTarget's position and range overlaps a room edge, this will split * the MoveTarget into two or four MoveTargets to cover an equivalent area without * overlapping the edge. Useful for pathing in range of a target, but making sure it's * at least in the same room. */ export declare function fixEdgePosition({ pos, range }: MoveTarget): MoveTarget[]; /** * Helper for calculating adjacent tiles */ export declare const calculateAdjacencyMatrix: (proximity?: number) => { x: number; y: number; }[]; /** * Positions in range 1 of `pos` (not includeing `pos`) */ export declare const calculateAdjacentPositions: (pos: RoomPosition) => RoomPosition[]; /** * Positions within `proximity` of `pos`, optionally including `pos` */ export declare const calculateNearbyPositions: (pos: RoomPosition, proximity: number, includeCenter?: boolean) => RoomPosition[]; /** * Positions at `proximity` of `pos` */ export declare const calculatePositionsAtRange: (pos: RoomPosition, proximity: number) => RoomPosition[]; /** * Adjacent positions that are pathable (optionally ignoring creeps) */ export declare const adjacentWalkablePositions: (pos: RoomPosition, ignoreCreeps?: boolean) => RoomPosition[]; /** * Check if a position is walkable, accounting for terrain, creeps, and structures */ export declare const isPositionWalkable: (pos: RoomPosition, ignoreCreeps?: boolean, ignoreStructures?: boolean) => boolean;