Fix trains overrunning stations and being unable to pathfind to current station#9876
Open
HB-Stratos wants to merge 2 commits intoCreators-of-Create:mc1.21.1/devfrom
Open
Fix trains overrunning stations and being unable to pathfind to current station#9876HB-Stratos wants to merge 2 commits intoCreators-of-Create:mc1.21.1/devfrom
HB-Stratos wants to merge 2 commits intoCreators-of-Create:mc1.21.1/devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes an issue where in very specific rail network shapes a train could overrun the station it intended to stop at by a minuscule amount. If the train was given a looping schedule sending it only to the station it is currently stopped at (and there was another station of the same name in the network), the train would discard its current station from the pathfinding calculation as it was technically behind it on the initial edge of the graph, and thus the train would leave towards the other station with the same name despite already being at a valid target.
This fix is implemented by selectively patching out a seeming bodge that makes trains always overshoot their target by 0.25 blocks. Testing on my end has not shown any change in behavior (other than stations working correctly) from patching this overshoot code out when a train is approaching a station instead of a signal. It is possible that the bodge could be removed completely, but this was the minimum possible to fix the current issue.