Page 1 of 1

[2.1.9] Moving a train manually prevents script fast_replace from working

Posted: Thu Jul 02, 2026 3:48 am
by robot256
What did you do?
1. Open a map with Quality mod enabled.
2. Place a locomotive on some track and build a station some distance in front of it.
3. Without moving it, select the locomotive and run the following command to replace it with a legendary locomotive:
/c local e = game.player.selected; e.surface.create_entity{name="locomotive", quality="legendary", position=e.position, orientation=e.orientation, force=e.force, fast_replace=true}
3. Enter the now-legendary locomotive and manually drive it forward any amount, then exit the locomotive
4. Select the locomotive and run the following command to try to replace it with an uncommon locomotive:
/c local e = game.player.selected; e.surface.create_entity{name="locomotive", quality="uncommon", position=e.position, orientation=e.orientation, force=e.force, fast_replace=true}
5. Observe the locomotive remains legendary.
6. Take an uncommon locomotive item and manually fast-replace the locomotive. Observe that it works.
What did you expect to happen?
I expected the second script fast-replace operation to complete just like the first one. There clearly isn't any underlying issue because the same operation can be completed manually without moving the locomotive. Even after manually upgrading the locomotive in the "bad" position, the script still cannot upgrade it.

The attached save contains a locomotive that was already "moved" and cannot be script-replaced.

Sending the train to a station stop in automatic mode seems to "realign" the position, and the script fast-replace will work again, at least until the train moves from the station stop location.

Re: [2.1.9] Moving a train manually prevents script fast_replace from working

Posted: Thu Jul 02, 2026 2:48 pm
by Rseding91
Thanks for the report. This is now fixed for the next release.