Skip to content

Conversation

@HB-Stratos
Copy link

I made a few changes to the /create trains and /create train debug 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 <...> nearest allows 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 that nearest or <UUID> are displayed in game.

grafik

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.

grafik Note that the weird printout of players seated is caused by a bug reported in #9866

Change 3:

/create trains was amended to include a button to display the schedule for this train.

grafik

Change 4:

/create trains was 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 train command.

grafik

Things I came across while editing the codebase:

  • Permalink The dump schedule command uses a really complex way of sending specific chat to specific places, when a for loop using 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.
  • The custom colors are hard-coded into DumpRailwaysCommand.java link instead of being available in a public style guide. A future addition may want to extract these. I have copied the colors to TrainCommand.java and added two extra colors I needed to make it work.
  • Create has a bug, the tooltip when hovering a players seated schedule condition does not show whether it is configured to be an exact match or a greater than match. This disagrees with the implementation used for liquids, items, etc. I have opened an issue regarding this as Incomplete tooltip for Schedule Condition Players Seated #9866
  • with now three buttons under each train in /create trains it may be worth considering moving the teleport button to the coordinate display that is present anyways, coloring the coordinates themselves orange and making them clickable.
  • The truncated UUID printing may be present in other debug commands. I did not go looking too far here. The copy on click feature should likely be extended to all of them.

@VoidLeech VoidLeech added the pr type: feature PR adds a new feature or changes an existing feature label Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr type: feature PR adds a new feature or changes an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants