From 08e6791e9e1a94b894313d3fc817cf7a880056c1 Mon Sep 17 00:00:00 2001 From: admon84 Date: Sun, 29 Nov 2020 18:49:17 -0700 Subject: [PATCH] PathFinder clarifications - Closes #154 --- api/source/PathFinder.md | 6 +++--- api/source/Room.md | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/api/source/PathFinder.md b/api/source/PathFinder.md index da62da97..175d1892 100644 --- a/api/source/PathFinder.md +++ b/api/source/PathFinder.md @@ -144,15 +144,15 @@ property | description {% api_method PathFinder.use 'isEnabled' 0 '{"deprecated": true}' %} ```javascript -PathFinder.use(true); +PathFinder.use(false); Game.creeps.John.moveTo(Game.spawns['Spawn1']); ``` -Specify whether to use this new experimental pathfinder in game objects methods. This method should be invoked every tick. It affects the following methods behavior: Room.findPath, RoomPosition.findPathTo, RoomPosition.findClosestByPath, Creep.moveTo. +`PathFinder` is enabled by default. This method can be used to disable `PathFinder` and use an older, slower algorithm (although doing so is not recommended). This method should be invoked every tick when used. It affects the following methods behavior: Room.findPath, RoomPosition.findPathTo, RoomPosition.findClosestByPath, Creep.moveTo. {% api_method_params %} isEnabled : boolean -Whether to activate the new pathfinder or deactivate. The default is `true`. +Whether to activate or deactivate the pathfinder. The default is `true`. {% endapi_method_params %} diff --git a/api/source/Room.md b/api/source/Room.md index adf1d1d7..18590cbb 100644 --- a/api/source/Room.md +++ b/api/source/Room.md @@ -313,7 +313,6 @@ creep.move(path[0].direction); ``` ```javascript -PathFinder.use(true); const path = creep.room.findPath(creep.pos, targetPos, { costCallback: function(roomName, costMatrix) { if(roomName == 'W1N5') { @@ -366,22 +365,22 @@ An object containing additonal pathfinding flags:
  • ignoreRoads
    boolean
    -
    Ignore road structures. Enabling this option can speed up the search. The default value is false. This is only used when the new PathFinder is enabled.
    +
    Ignore road structures. Enabling this option can speed up the search. The default value is false. This option is ignored if PathFinder has been disabled.
  • costCallback
    function(string, CostMatrix)
    -
    You can use this callback to modify a CostMatrix for any room during the search. The callback accepts two arguments, roomName and costMatrix. Use the costMatrix instance to make changes to the positions costs. If you return a new matrix from this callback, it will be used instead of the built-in cached one. This option is only used when the new PathFinder is enabled.
    +
    You can use this callback to modify a CostMatrix for any room during the search. The callback accepts two arguments, roomName and costMatrix. Use the costMatrix instance to make changes to the positions costs. If you return a new matrix from this callback, it will be used instead of the built-in cached one. This option is ignored if PathFinder has been disabled.
  • ignore
    array
    -
    An array of the room's objects or RoomPosition objects which should be treated as walkable tiles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).
    +
    An array of the room's objects or RoomPosition objects which should be treated as walkable tiles during the search. This option is ignored when PathFinder is enabled (use costCallback option instead).
  • avoid
    array
    -
    An array of the room's objects or RoomPosition objects which should be treated as obstacles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).
    +
    An array of the room's objects or RoomPosition objects which should be treated as obstacles during the search. This option is ignored when PathFinder is enabled (use costCallback option instead).
  • maxOps
    @@ -401,7 +400,7 @@ An object containing additonal pathfinding flags:
  • maxRooms
    number
    -
    The maximum allowed rooms to search. The default (and maximum) is 16. This is only used when the new PathFinder is enabled.
    +
    The maximum allowed rooms to search. The default (and maximum) is 16. This option is ignored if PathFinder has been disabled.
  • range