[fixed] [1.18.0] Error while running event LogisticTrainNetwork::on_train_changed_state (ID 25)

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

cinebum
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Dec 12, 2022 10:40 pm
Contact:

[fixed] [1.18.0] Error while running event LogisticTrainNetwork::on_train_changed_state (ID 25)

Post by cinebum »

Hello!

I love LTN. I'm deep into a playthrough and all of a sudden, this nonrecoverable error started popping up. Honestly, it happened when I wasn't doing anything with trains. I have attempted to figure out if something is off, but, with this kind of error, you don't get to explore when it happens.

A train is called to pick up coke, then anothere train is called to pick up coke at another station. The first train hits the 5000 mark loading, and the second train is about half way to the station when the error occurs. It could be another train that was unable to be marked for delivery. I don't know. I do know that this error renders this 70 hour save useless unless I can figure out what I did wrong. :(
2022-12-12_18-13-07.png
2022-12-12_18-13-07.png (72.76 KiB) Viewed 1287 times
Attachments
factorio-current.log
(1.02 MiB) Downloaded 50 times

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

Re: [fixed] [1.18.0] Error while running event LogisticTrainNetwork::on_train_changed_state (ID 25)

Post by Optera »

A stop entity was removed just as a train left it.
Added additional check against this for next release.

Edit:
This error only happens when other mods remove stops without raising script_raised_destroy. Otherwise entity removal is handled before train updates.

cinebum
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Dec 12, 2022 10:40 pm
Contact:

Re: [fixed] [1.18.0] Error while running event LogisticTrainNetwork::on_train_changed_state (ID 25)

Post by cinebum »

Thanks for that! Can you give me a little more insight? When you say a stop entity was removed, what do you mean? If there's something I can do in the minute or two before it fails, then at least I can get back to playing. Thanks for the quick turnaround!

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

Re: [fixed] [1.18.0] Error while running event LogisticTrainNetwork::on_train_changed_state (ID 25)

Post by Optera »

Didn't 1.18.1 solve your issue?

cinebum
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Dec 12, 2022 10:40 pm
Contact:

Re: [fixed] [1.18.0] Error while running event LogisticTrainNetwork::on_train_changed_state (ID 25)

Post by cinebum »

Yes it did! Sorry, I read your message like you'll release it when your next release window opens. I didn't realize it had already been released.

I am curious about the details though. If another mod is not playing nice, I'd like to understand it and report it. Thanks again for the fast fix!

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

Re: [fixed] [1.18.0] Error while running event LogisticTrainNetwork::on_train_changed_state (ID 25)

Post by Optera »

I wrote the details in the changelog
Version: 1.18.1
Date: 2022-12-13
Bugfixes:
- crash when on_train_changed_state is raised for trains stopped at invalid stops. Should only happen if scripts remove stops without raising script_raised_destroy.
For non developers:
Normally removing a stop first raises a remove event before the train state changes. Due to the no longer existing stop the train is now in a different state and a train state changed event is raised.
In your case train state changed was raised for a train leaving a no longer existing stop without a removal event for the stop.

Most likely another mod removed the stop without notifying other mods. Unlike built in removal events, script_raised_destroy has to be called explicitly.

Anyways while LTN is quite robust against it, other mods changing it's entities can result in unexpected behavior.

Post Reply

Return to “Logistic Train Network”