Page 1 of 1

[2.0.73] on_train_changed_state fires twice with incorrect info

Posted: Thu Feb 05, 2026 8:07 am
by BurninSun
Create train. Add schedule to train. Switch train from manual mode to automatic mode.

on_train_changed_state will now fire twice. The first will correctly include event.old_state == defines.train_state.manual_control and correctly changes the trains current state to on_the_path (or no_path or destination_full if appropriate).

Then on_train_changed_state fires again. This time it incorrectly includes event.old_state == defines.train_state.no_schedule. Not only is this old_state incorrect (for either before or after the previous on_train_changed_state event), but it is also redundant.

This second event should not fire.

Re: [2.0.73] on_train_changed_state fires twice with incorrect info

Posted: Thu Feb 05, 2026 1:18 pm
by Rseding91
Thanks for the report however this is not a bug. The logic is automatic whenever the state is changed and always correct. If it fires, the state was the old value at some point and since changed.