Skip to content

Commit 08e6791

Browse files
committed
PathFinder clarifications - Closes screeps#154
1 parent 2e5eef8 commit 08e6791

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

api/source/PathFinder.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ property | description
144144
{% api_method PathFinder.use 'isEnabled' 0 '{"deprecated": true}' %}
145145

146146
```javascript
147-
PathFinder.use(true);
147+
PathFinder.use(false);
148148
Game.creeps.John.moveTo(Game.spawns['Spawn1']);
149149
```
150150

151-
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: <a href="#Room.findPath"><code>Room.findPath</code></a>, <a href="#RoomPosition.findPathTo"><code>RoomPosition.findPathTo</code></a>, <a href="#RoomPosition.findClosestByPath"><code>RoomPosition.findClosestByPath</code></a>, <a href="#Creep.moveTo"><code>Creep.moveTo</code></a>.
151+
`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: <a href="#Room.findPath"><code>Room.findPath</code></a>, <a href="#RoomPosition.findPathTo"><code>RoomPosition.findPathTo</code></a>, <a href="#RoomPosition.findClosestByPath"><code>RoomPosition.findClosestByPath</code></a>, <a href="#Creep.moveTo"><code>Creep.moveTo</code></a>.
152152

153153
{% api_method_params %}
154154
isEnabled : boolean
155-
Whether to activate the new pathfinder or deactivate. The default is `true`.
155+
Whether to activate or deactivate the pathfinder. The default is `true`.
156156
{% endapi_method_params %}
157157

158158

api/source/Room.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ creep.move(path[0].direction);
313313
```
314314

315315
```javascript
316-
PathFinder.use(true);
317316
const path = creep.room.findPath(creep.pos, targetPos, {
318317
costCallback: function(roomName, costMatrix) {
319318
if(roomName == 'W1N5') {
@@ -366,22 +365,22 @@ An object containing additonal pathfinding flags:
366365
<li>
367366
<div class="api-arg-title">ignoreRoads</div>
368367
<div class="api-arg-type">boolean</div>
369-
<div class="api-arg-desc">Ignore road structures. Enabling this option can speed up the search. The default value is false. This is only used when the new <a href="#PathFinder"><code>PathFinder</code></a> is enabled.</div>
368+
<div class="api-arg-desc">Ignore road structures. Enabling this option can speed up the search. The default value is false. This option is ignored if <a href="#PathFinder"><code>PathFinder</code></a> has been disabled.</div>
370369
</li>
371370
<li>
372371
<div class="api-arg-title">costCallback</div>
373372
<div class="api-arg-type">function(string, CostMatrix)</div>
374-
<div class="api-arg-desc">You can use this callback to modify a <a href="#PathFinder-CostMatrix"><code>CostMatrix</code></a> for any room during the search. The callback accepts two arguments, <code>roomName</code> and <code>costMatrix</code>. Use the <code>costMatrix</code> 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 <a href="#PathFinder"><code>PathFinder</code></a> is enabled.</div>
373+
<div class="api-arg-desc">You can use this callback to modify a <a href="#PathFinder-CostMatrix"><code>CostMatrix</code></a> for any room during the search. The callback accepts two arguments, <code>roomName</code> and <code>costMatrix</code>. Use the <code>costMatrix</code> 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 <a href="#PathFinder"><code>PathFinder</code></a> has been disabled.</div>
375374
</li>
376375
<li>
377376
<div class="api-arg-title">ignore</div>
378377
<div class="api-arg-type">array</div>
379-
<div class="api-arg-desc">An array of the room's objects or <a href="#RoomPosition">RoomPosition</a> objects which should be treated as walkable tiles during the search. This option cannot be used when the new <a href="#PathFinder"><code>PathFinder</code></a> is enabled (use <code>costCallback</code> option instead).</div>
378+
<div class="api-arg-desc">An array of the room's objects or <a href="#RoomPosition">RoomPosition</a> objects which should be treated as walkable tiles during the search. This option is ignored when <a href="#PathFinder"><code>PathFinder</code></a> is enabled (use <code>costCallback</code> option instead).</div>
380379
</li>
381380
<li>
382381
<div class="api-arg-title">avoid</div>
383382
<div class="api-arg-type">array</div>
384-
<div class="api-arg-desc">An array of the room's objects or <a href="#RoomPosition">RoomPosition</a> objects which should be treated as obstacles during the search. This option cannot be used when the new <a href="#PathFinder"><code>PathFinder</code></a> is enabled (use <code>costCallback</code> option instead).</div>
383+
<div class="api-arg-desc">An array of the room's objects or <a href="#RoomPosition">RoomPosition</a> objects which should be treated as obstacles during the search. This option is ignored when <a href="#PathFinder"><code>PathFinder</code></a> is enabled (use <code>costCallback</code> option instead).</div>
385384
</li>
386385
<li>
387386
<div class="api-arg-title">maxOps</div>
@@ -401,7 +400,7 @@ An object containing additonal pathfinding flags:
401400
<li>
402401
<div class="api-arg-title">maxRooms</div>
403402
<div class="api-arg-type">number</div>
404-
<div class="api-arg-desc">The maximum allowed rooms to search. The default (and maximum) is 16. This is only used when the new <a href="#PathFinder"><code>PathFinder</code></a> is enabled.</div>
403+
<div class="api-arg-desc">The maximum allowed rooms to search. The default (and maximum) is 16. This option is ignored if <a href="#PathFinder"><code>PathFinder</code></a> has been disabled.</div>
405404
</li>
406405
<li>
407406
<div class="api-arg-title">range</div>

0 commit comments

Comments
 (0)