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

Bugs which we just recently fixed in our development version and will reach you in the next release.
robot256
Smart Inserter
Smart Inserter
Posts: 1379
Joined: Sun Mar 17, 2019 1:52 am
Contact:

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

Post 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.
Attachments
LocomotiveSnapTest3.zip
(1.62 MiB) Downloaded 4 times
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17091
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved for the next release”