Include pos: RoomPosition in result of PathFinder.search
-
I'm currently coding around this little wrinkle.
The implementation of PathFinder.search and its behavior regarding goal position and range means that there will always be an ambiguity if two goals only have a single square between them.
If the user is trying to differentiate between targets within 1 square of each other the lack of position in the output means that the goals needs to be maintained in a separate datastructure in order to disambiguate the result.
For example: I am pathfinding in the simulator room. I have cached the positions adjacent to the energy using structures to solve this problem in general. However when I place my spawn adjacent to a source then my cache will have an ambiguous case. In that case the list of goals I have prepared needs to be iterated in order to disambiguate the output of PathFinder.search.
My current plan is to merge all such entities into a superstructure or simply handle the edge case of very close goals separately.
-
Additional use-case: screeeps.com/a/#!/room/E76S1 adjacent sources.