Raise events when trains are removed

notnotatschool
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Feb 17, 2021 1:01 am
Contact:

Raise events when trains are removed

Post by notnotatschool »

I have a mod which displays information about trains. This information is updated whenever trains are created, split, enter or exit manual mode, and in a few other scenarios. However, it's not currently possible to tell whether a train has been completely removed due to its last rolling stock being removed without tracking when every rolling stock in the world is removed. I'd like an event called something like

Code: Select all

on_train_destroyed
that is raised when a LuaTrain is destroyed without any new train being created in its place like in

Code: Select all

on_train_created
.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3272
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Raise events when trains are removed

Post by boskid »

I think this may be considered as implemented for 2.0 as there was "register_on_object_destroyed" implemented which supports LuaTrain. In that case when a train is destroyed (where by train we should consider "specific composition of stocks" so 2 trains may be destroyed when merging them into 1 new train) it will raise a notification on_object_destroyed if you registered that train for notifications.
Post Reply

Return to “Implemented mod requests”