Support for returning false by costCallback option of Room.findPath. #113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently
roomCallbackinPathFinder.searchhas an option to return false instead of cost matrix to efficiently avoid the room entirely. There is no easy way to do that fromCreep.moveToefficiently, since it would require replacingroomCallbackin_findPath2. One could usePathFinderdirectly, but that results in losing much ofCreep.moveToutility such as path caching, at least without knowledge ofmoveTointernals such as_move.roomCallbackcreates the cost matrix and passes it tocostCallbackto modify it. WhencostCallbackreturns something else, it is ignored. No exception or anything. I propose that at least whencostCallbackreturnsfalse, it should be treated as ifroomCallbackreturned false. This isn't as efficient as coding customroomCallback, since the cost matrix is still created, but at least it is fully compatible with existing code and will not require the player to code all functionality betweenCreeps.moveToandRoom.findPathif they just want to avoid certain rooms, e.g., rooms owned enemies.