Replies: 1 comment
-
I can't think of a scenario that would require multiple transports to be chained, since the walker will come back in it after it has used the transport in the next loop to continue walking I think it makes sense to exit the function. But needs to be tested. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is some magic going on inside
Rs2Walker.handleTransportsthat I need help with understanding.This function is called every step in the path in
Rs2Walker.processWalkso see if there's a transport that the web should take here:The handleTransports function starts with obtaining all the Transports that are stored for the current tile:
Set<Transport> transports = ShortestPathPlugin.getTransports().getOrDefault(path.get(indexOfStartPoint), new HashSet<>());Take note: this also includes teleports (with origin null) on the first step in the path as teleports are always added to the starting tile of the path.
Then, the handleTransports function loops over all Transports that it received for the current step
path.get(indexOfStartPoint)which is actuallyiand increases every loop ofprocessWalk.Now, I understand that we need to work through a list of Transports because in the walker we don't have access to the actual path of
Nodes andTransports that were generated by thePathfinder. To determine whichTransportout of the list for thisWorldPointthePathfindermeant to make use of,handleTransportsloops through the received Transports. By doing checks like:if (path.stream().noneMatch(x -> x.equals(transport.getDestination()))) continue;we can pin down the Transport that the path meant to take.So far so good... Now the thing that I don't understand is: why don't we exit the function after handling a transport that passed all the filters and thus we determined we should take for this step in the path? Instead of exiting the function, it breaks the
for (WorldPoint origin : worldPointCollections) {and continues looping further through all the other transports available this step and might chain multiple transports for the original step in the path after each other.Is this behavior intentional and are there scenario's that I cannot think of that requires this behavior? Or was this just never a problem until PoH was introduced?
Beta Was this translation helpful? Give feedback.
All reactions