Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Movement

This is the movement library for Overmind. It was originally based on BonzAI's Traveler library, but it has been extensively modified to integrate more tightly with the Overmind framework and add additional functionality.

Hierarchy

  • Movement

Index

Methods

Static Private circle

  • circle(pos: RoomPosition, color: string, opacity?: undefined | number): RoomVisual
  • Draw a circle

    Parameters

    • pos: RoomPosition
    • color: string
    • Optional opacity: undefined | number

    Returns RoomVisual

Static combatMove

  • combatMove(creep: Zerg, approach: PathFinderGoal[], avoid: PathFinderGoal[], options?: CombatMoveOptions): number

Static Private combatMoveCallbackModifier

  • combatMoveCallbackModifier(room: Room, matrix: CostMatrix, approach: PathFinderGoal[], avoid: PathFinderGoal[], options: CombatMoveOptions): CostMatrix

Static Private deserializeState

  • deserializeState(moveData: MoveData, destination: RoomPosition): MoveState

Static Private findBlockingCreep

  • findBlockingCreep(creep: Zerg): Creep | undefined

Static flee

  • flee(creep: Zerg, avoidGoals: (RoomPosition | HasPos)[], dropEnergy?: boolean, options?: MoveOptions): number | undefined
  • Flee from avoid goals in the room while not re-pathing every tick like kite() does.

    Parameters

    • creep: Zerg
    • avoidGoals: (RoomPosition | HasPos)[]
    • Default value dropEnergy: boolean = false
    • Default value options: MoveOptions = {}

    Returns number | undefined

Static Private getPushDirection

  • getPushDirection(pusher: Zerg | Creep, pushee: Zerg | Creep): DirectionConstant

Static Private getPushPriority

  • getPushPriority(creep: Creep | Zerg): number

Static goTo

  • goTo(creep: Zerg, destination: HasPos | RoomPosition, options?: MoveOptions): number

Static goToRoom

Static goToRoom_swarm

Static invasionMove

  • invasionMove(creep: Zerg, destination: RoomPosition | HasPos, options?: MoveOptions): number
  • Moving routine for guards or sourceReapers in a room with NPC invaders

    Parameters

    • creep: Zerg
    • destination: RoomPosition | HasPos
    • Default value options: MoveOptions = {}

    Returns number

Static Private invasionMoveCallbackModifier

  • invasionMoveCallbackModifier(room: Room, matrix: CostMatrix): CostMatrix

Static Private isStuck

Static kite

  • kite(creep: Zerg, avoidGoals: (RoomPosition | HasPos)[], options?: MoveOptions): number | undefined
  • Kite around enemies in a single room, repathing every tick. More expensive than flee().

    Parameters

    • creep: Zerg
    • avoidGoals: (RoomPosition | HasPos)[]
    • Default value options: MoveOptions = {}

    Returns number | undefined

Static moveOffCurrentPos

  • moveOffCurrentPos(creep: Zerg): number | undefined
  • Moves a creep off of the current tile to the first available neighbor

    Parameters

    Returns number | undefined

Static moveOffExit

  • moveOffExit(creep: Zerg, avoidSwamp?: boolean): ScreepsReturnCode
  • Moves off of an exit tile

    Parameters

    • creep: Zerg
    • Default value avoidSwamp: boolean = true

    Returns ScreepsReturnCode

Static moveOffExitToward

  • moveOffExitToward(creep: Zerg, pos: RoomPosition, detour?: boolean): number | undefined
  • Moves off of an exit tile toward a given direction

    Parameters

    • creep: Zerg
    • pos: RoomPosition
    • Default value detour: boolean = true

    Returns number | undefined

Static moveOnExit

  • moveOnExit(creep: Zerg): ScreepsReturnCode | undefined

Static pairwiseMove

  • pairwiseMove(leader: Zerg, follower: Zerg, target: HasPos | RoomPosition, opts?: MoveOptions, allowedRange?: number): number | undefined
  • Moves a pair of creeps; the follower will always attempt to be in the last position of the leader

    Parameters

    • leader: Zerg
    • follower: Zerg
    • target: HasPos | RoomPosition
    • Default value opts: MoveOptions = {} as MoveOptions
    • Default value allowedRange: number = 1

    Returns number | undefined

Static park

  • park(creep: Zerg, pos?: RoomPosition, maintainDistance?: boolean): number
  • Park a creep off-roads

    Parameters

    • creep: Zerg
    • Default value pos: RoomPosition = creep.pos
    • Default value maintainDistance: boolean = false

    Returns number

Static pushCreep

  • pushCreep(creep: Zerg, otherCreep: Creep | Zerg): boolean

Static recursivePush

  • recursivePush(creep: Zerg, excludePos?: RoomPosition[]): RoomPosition | undefined
  • Recursively pushes creeps out of the way of a root position.

    Parameters

    • creep: Zerg
    • Default value excludePos: RoomPosition[] = []

    Returns RoomPosition | undefined

Static Private serializeState

  • serializeState(creep: Zerg, destination: RoomPosition, state: MoveState, moveData: MoveData, nextCoord?: Coord | RoomPosition | undefined): void

Static Private shouldPush

  • shouldPush(pusher: Creep | Zerg, pushee: Creep | Zerg): boolean

Static swarmCombatMove

  • swarmCombatMove(swarm: Swarm, approach: PathFinderGoal[], avoid: PathFinderGoal[], options?: CombatMoveOptions): number

Static swarmMove

Static Private updateStateNextCoord

  • updateStateNextCoord(moveData: MoveData, nextCoord: Coord | RoomPosition): void
  • Update the currentXY property for a move state

    Parameters

    • moveData: MoveData
    • nextCoord: Coord | RoomPosition

    Returns void

Static vacatePos

  • vacatePos(pos: RoomPosition, suicide?: boolean): boolean
  • Recursively moves creeps out of the way of a position to make room for something, such as a spawning creep. If suicide is specified and there is no series of move commands that can move a block of creeps out of the way, the lead blocking creep will suicide. Returns whether the position has been vacated.

    Parameters

    • pos: RoomPosition
    • Default value suicide: boolean = false

    Returns boolean

Generated using TypeDoc