Page 1 of 1

0.15.12 on_train_created: no old_id when mining

Posted: Thu May 18, 2017 6:23 pm
by Choumiko
on_train_created doesn't contain the old_id of the train when mining a locomotive/cargowagon from a train

To reproduce:
Build a train (with at least 2 carriages)
Run:

Code: Select all

/c script.on_event(defines.events.on_train_created, function(e) game.print(string.format("%d : train id: %d, old_train_id_1: %s, old_train_id_2: %s", game.tick, e.train.id, e.old_train_id_1, e.old_train_id_2))end)
Mine any carriage of the train, the print shows nil for both old ids. If you split the train into 2 trains by mining a middle carriage, both on_train_created events have no old_train_id

I'd expect it to have an old_train_id_1, so that a mod could copy/remove the data it may have about that old train.
(Haven't tested if the old LuaTrain is already invalid, but since it doesn't get passed in the event it shouldn't matter)

Re: 0.15.12 on_train_created: no old_id when mining

Posted: Thu May 18, 2017 8:57 pm
by Rseding91
Thanks for noticing. It's now fixed for the next version of 0.15.