-
Notifications
You must be signed in to change notification settings - Fork 37
Traveler API
crazydubc edited this page Dec 13, 2020
·
11 revisions
argument | type | description |
---|---|---|
creep |
Creep | The creep you want to move. |
goal |
Object | Object with a property pos: RoomPosition . |
options |
Object | Optional object with one or more of properties described below |
property | type | description |
---|---|---|
ignoreRoads |
boolean | Creeps won't prefer roads above plains (will still prefer them to swamps). Default is false . |
ignoreCreeps |
boolean | Will not path around other creeps. Default is true . |
offRoad |
boolean | Creeps won't prefer plains or roads over swamps, all costs will be 1. Default is false . |
stuckValue |
boolean | Number of ticks of non-movement before a creep considers itself stuck. Default is 2. |
ignoreStructures |
boolean | Will not path around structures. Default is false . |
preferHighway |
boolean | Creep prefer to travel along highway (empty rooms in between sectors). Default is false
|
allowHostile |
boolean | Hostile rooms will be included in path. Default is false . |
allowSK |
boolean | SourceKeeper rooms will be included in path. (if false , SK rooms will still be taken if they are they only viable path). Default is false . |
range |
number | Range to goal before it is considered reached. The default is 1. |
obstacles |
Object[] | Array of objects with property {pos: RoomPosition} that represent positions to avoid. |
roomCallback |
function | Callback function that accepts two arguments, roomName (string) and matrix (CostMatrix) and returns a CostMatrix or boolean. Used for overriding the default PathFinder callback. If it returns false , that room will be excluded. If it returns a matrix, it will be used in place of the default matrix. If it returns undefined the default matrix will be used instead. |
routeCallback |
function | Callback function that accepts one argument, roomName (string) and returns a number representing the foundRoute value that roomName. Used for overriding the findRoute callback. If it returns a number that value will be used to influence the route. If it returns undefined it will use the default value. |
returnData |
Object | If an empty object literal is provided, the RoomPosition being moved to will be assigned to returnData.nextPos . |
restrictDistance |
number | Limits the range the findRoute will search. Default is 32. |
useFindRoute |
boolean | Can be used to force or prohibit the use of findRoute. If undefined it will use findRoute only for paths that span a larger number of rooms (linear distance >2). |
maxOps |
number | Limits the ops (CPU) that PathFinder will use. Default is 20000. (~20 CPU) |
movingTarget |
boolean | Allows you to avoid making a new pathfinding call when your destination is only 1 position away from what it was previously. The new direction is just added to the path. Default is false . |
repath |
number | Float value between 0 and 1 representing the probability that creep will randomly invalidate its current path. Setting it to 1 would cause the creep to repath every tick. Default is undefined . |
travelData |
Object | Passing in an empty object will allow traveler to populate it with details about the current situation, including pathfinder return results, next position, and its travel state. Default is undefined . |
ensurePath |
boolean | This can improve the chance of finding a path in certain edge cases where might otherwise fail. Default is false . |
freshMatrix |
boolean | Will guarantee that a new structure matrix is generated. This might be necessary if structures are likely to change often. Default is false . |
maxRooms |
number | Limit how many rooms can be searched by PathFinder. Default is undefined . |
route |
Object | Supply the route to be used by PathFinder. Default is undefined . |