Improve /create trains and /create train command: Added schedule information and copy UUID on hover #9868
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.
I made a few changes to the
/create trainsand/create traindebug commands.The changes were largely motivated by my server building a relatively large and complex train network that likes to have some problems that are hard to debug. Further PRs to fix some of these bugs will likely follow.
While a large part of it was written with help of Claude Sonnet 4.5, I have verified all code manually to the best of my ability and tested all changes in game. This PR was also written by me.
Change 1:
/create train <...> nearestallows a player to use the create train command to target a single train without having to know the full UUID. As there are now two entries for input options, the code suggestion was edited such thatnearestor<UUID>are displayed in game.Change 2:
/create train schedule <...>allows a player to dump the full schedule a train currently has into the chat for debugging. This became necessary as an auto schedule assigned to a train by a station with a schedule on top can not be taken off the train and then read by the player. As such, this is the only way to understand what a train with an auto schedule is even trying to do.Change 3:
/create trainswas amended to include a button to display the schedule for this train.Change 4:
/create trainswas extended to allow copying of the full UUID when hovering over it. This applies to all UUIDs including graph, track edge and train. When a UUID is clicked it is copied to the clipboard for further use, for example in the/create traincommand.Things I came across while editing the codebase:
sendSuccess()appears to work pretty well. It does print twice in the dev console as chat log and server chat log, but that seems acceptable.