include previous train state in on_train_changed_state

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

include previous train state in on_train_changed_state

Post by Optera »

I need to remove a trains from a global list when they leave a stop (or are switched to manual).
Currently I have to trigger on the states on_the_path, no_path, no_schedule or manual_control producing quite some overhead, or keep all states stored in a trainID indexed table inside the mod.

Having the former state passed along as last_state similar to on_train_created(old_train_id_1) would make working with states a bit simpler.

Even more comfortable for finding stops a train just left would be to include the stop entity as last_stop similar to on_selected_entity_changed( last_entity).
Rseding91
Factorio Staff
Factorio Staff
Posts: 14912
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: include previous train state in on_train_changed_state

Post by Rseding91 »

Ok, I added it for 0.16.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Implemented mod requests”