UNPKG

screeps-cartographer

Version:

An advanced (and open source) movement library for Screeps

54 lines (53 loc) 1.9 kB
/// <reference types="screeps" /> interface MoveIntent { creep: Creep | PowerCreep; priority: number; targets: RoomPosition[]; resolved?: boolean; targetCount?: number; } /** * Gets the current tick's move intents, recreating the indexes * if the data is stale from the previous tick * * Returns: * - creep: Index of intents by creep * - priority: Index of intents by priority, then by number of viable target squares, then by creep * - targets: Index of intents by position, then by creep * - pullers: Index of puller creeps */ export declare function getMoveIntents(room: string): { creep: Map<Id<Creep | PowerCreep>, MoveIntent>; priority: Map<number, Map<number, Map<Id<Creep | PowerCreep>, MoveIntent>>>; targets: Map<string, Map<Id<Creep | PowerCreep>, MoveIntent>>; pullers: Set<Id<Creep | PowerCreep>>; pullees: Set<Id<Creep | PowerCreep>>; prefersToStay: Set<string>; blockedSquares: Set<string>; }; /** * Lists the rooms with move intents to handle */ export declare function getMoveIntentRooms(): string[]; /** * Register a pull intent (used to avoid breaking trains of * pulled creeps) */ export declare function registerPull(puller: Creep, pullee: Creep): void; /** * Register a move intent (adds to a couple indexes for quick lookups) */ export declare function registerMove(intent: MoveIntent, pulled?: boolean): void; /** * Register a move intent (adds to a couple indexes for quick lookups) */ export declare function cancelMove(intent?: MoveIntent): void; /** * Updates an intent's indexes when its target count changes */ export declare function updateIntentTargetCount(intent: MoveIntent, oldCount: number, newCount: number): void; /** * Blocks a specific square, to vacate a space for e.g. creating a construction site or spawning */ export declare function blockSquare(pos: RoomPosition): void; export {};