Module

Screeps.Path

Package
purescript-screeps-classy
Repository
purescript/purescript-screeps

This module implements PathFinder API.

WARNING: While PathFinder accepts any number of target objects, excessive GC may occur if there are too many. API author advises to sort targets by uniform distance [Screeps.Coord], and use only first 10 or so.

#TileCost Source

type TileCost = Int

#defaultTerrainCost Source

#unwalkable Source

unwalkable :: TileCost

Indicates an unwalkable tile.

#PATH Source

data PATH :: Effect

#PathFinderResult Source

newtype PathFinderResult

Constructors

#PathFinderTarget Source

newtype PathFinderTarget

Constructors

#usePathFinder Source

usePathFinder :: forall e. Eff (path :: PATH | e) Unit

#newCostMatrix Source

newCostMatrix :: forall e. Eff (path :: PATH | e) CostMatrix

#defaultPathFinderOpts Source

#RoomCallback Source

type RoomCallback e = RoomName -> Eff (path :: PATH | e) CostMatrix

#allDefaultCosts Source

allDefaultCosts :: forall e. RoomCallback e

Empty callback - just use default terrain cost.

#PathFinderOpts Source

newtype PathFinderOpts e

Constructors

#set Source

set :: forall e. CostMatrix -> Int -> Int -> TileCost -> Eff (path :: PATH | e) Unit

Set a given coordinate to any cost.

#get Source

get :: forall e. CostMatrix -> Int -> Int -> Eff (path :: PATH | e) TileCost

Get current cost of any coordinate. Zero indicates default terrain cost.

#clone Source

clone :: forall e. CostMatrix -> Eff (path :: PATH | e) CostMatrix

Clone cost matrix.

#SerializedCostMatrix Source

newtype SerializedCostMatrix

Serialized cost matrix, suitable for JSON.stringify.

Constructors

Instances

#serialize Source

serialize :: CostMatrix -> SerializedCostMatrix

Serialize cost matrix for storage in Memory.

#deserialize Source