remove a locomotive from a 2 entity train. The game has to disconnect the loco first before removal. Using an event react to the train being changed (losing its loco) and tell the loco to re-join back to the train. Game crashes at this point.
- load attached save (test.zip), just 2 locomotives on a rail connected as a train.
- run the attached Lua script to crash the game. It sets up the event function to try and rejoin the locomotives when their train changes and then removes one of the locomotives.
I found this as I noticed that the carriage didn't have a train attribute in the same setup and this surprised me (and crashed my mod). So I found this while quickly exploring the risks of this situation