/// import { RoomName, Coordinates, Area } from "./types"; /** * Whether or not this position is an exit. Ignoring terrain. * @param at A room position * @param range Optional distance to exits * @returns Is this position at the edge of the room */ export declare function isExit(at: Coordinates, range?: number): boolean; /** * Whether or not this position is inside of a room. * @param at A room position * @returns Is this position valid room coordinates */ export declare function isInRoom(at: Coordinates): boolean; /** Object with a {@link RoomPosition} to {@link normalizePos} */ export type SomeRoomPosition = RoomPosition | _HasRoomPosition; /** * Extract position from an object with a position * @param it Object with a position * @returns The RoomPosition */ export declare function normalizePos(it: SomeRoomPosition): RoomPosition; /** * Split a room name in parts * @param roomName Valid name of a room * @returns Room name parts [full string, WE, x, NS, y] */ export declare function parseRoomName(roomName: RoomName): [string, "E" | "W", number, "N" | "S", number]; /** * Convert a room name into a 2d point * @param roomName Valid name of a room * @returns 2d coordinates (1:ROOM_SIZE scale) */ export declare function getRoomNameCoords(roomName: RoomName): Coordinates; /** Room type information without visibility required */ export declare enum RoomSectorKind { /** With portals and terminal */ Intersection = -2, /** With deposits and powerBanks */ Highway = -1, /** With a controller aka normal */ Controller = 0, /** With sourceKeepers and mineral */ SourceKeeper = 1, /** With portals at sector's center */ Center = 2 } /** * Get room type information without visibility required. * @param name Valid name of a room * @returns an enum with room kind */ export declare function getRoomSectorKind(name: RoomName): RoomSectorKind; /** * Compute center position of a room * @param name valid room name * @returns position at the middle of this room */ export declare const getRoomCenter: (name: RoomName) => RoomPosition; /** * Distance when moving only vertically, horizontally and diagonally. * Correct distance for in room creep movements. * @param a First point * @param b Second point * @returns Chebyshev distance between those points */ export declare function getChebyshevDist(a: Coordinates, b: Coordinates): number; /** * Distance when moving only vertically or horizontally. * Correct distance for inter room creep movements. * @param a First point * @param b Second point * @returns Manhattan distance between those points */ export declare function getManhattanDist(a: Coordinates, b: Coordinates): number; /** * Distance when moving at any angle. * @param a First point * @param b Second point * @returns Euclidean distance between those points */ export declare function getEuclidDist(a: Coordinates, b: Coordinates): number; /** * Compute the nearest angle between two point round to 8 directions * @param from First point * @param to Second point * @returns Direction constant */ export declare function getDirectionTo(from: Coordinates, to: Coordinates): 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8; /** * Compute position in a given direction * @param pos start position * @param d direction constant * @param n number of steps * @returns destination position */ export declare function getToDirection(pos: RoomPosition, d: DirectionConstant, n?: number): RoomPosition | undefined; /** * Clamp coordinates in room range. * @param at point to clamp * @returns clamped coordinates */ export declare function clampInRoom(at: Coordinates): Coordinates; /** * List all {@link RoomPosition} in a given square clamped to room borders * @param center middle point * @param range positive integer * @yields a valid position */ export declare function inRoomRange(center: RoomPosition, range?: number): Generator; /** * List all {@link Coordinates} in a given square clamped to room borders * @param center middle point * @param range positive integer * @yields a coordinate in room */ export declare function inRoomRangeXY(center: Coordinates, range?: number): Generator; /** * Get an area in a given square clamped to room borders. * @param center middle point * @param range positive integer * @returns area in room */ export declare function inRoomRangeArea(center: Coordinates, range?: number): Area; /** * List all {@link RoomPosition} at a given square border excluding out of room * @param center middle point * @param range positive integer * @yields a valid position */ export declare function atRoomRange(center: RoomPosition, range?: number): Generator; /** * Get all directions for nearest to oppositive of {@link d}. * @param d nearest direction * @returns a sorted array of directions */ export declare const getDirectionsSorted: (d: DirectionConstant) => DirectionConstant[];