Temporary Stations (Wait Conditions and Personal Trains)


The mod lets you control the behaviour of trains upon arriving at temporary stations. The train either switches to manual mode or waits with custom conditions. You can also define a Train as your Personal Train and use the shortcut to call that train to your position.

Content
4 years ago
0.17 - 0.18
38
Trains

i Tracking changes of train ID for personal trains

4 years ago

Hi,

First of all - thanks for this amazing mod, it was really amazing coming from vanilla playthrough and getting ability to summon a personal train without having to go through a lot of hassle of tracking it down/placing it down etc. A really amazing addition.

I am aware of the limitation regarding the changing train IDs (partly because I just poked around a little bit to understand how/when it happens), but I was wondering if it would be possible to keep track of such changes via the on_trian_created (https://lua-api.factorio.com/latest/events.html#on_train_created) event.

From what I have seen, every time you attach an additional wagon to the train, the game will first create a temporary train, triggering first event with temporary train object and old_train_id_1 and old_train_id_2 set to nil, and then it will merge the old train with the temporary one, triggering a second event with new train object and setting old_train_id_1 and old_train_id_2 to old and temporary train IDs (not 100% sure what the ordering would be).

Thus, by registering with this event, I think it should be possible to keep track of personal trains across attaching/merging of additional wagons.

Does this make sense? I'm not so good with Lua, but I could probably try to have a look at the code and try to submit it to you if you would find such addition and help useful.

Best regards,
Branko

New response