[Rseding91] [2.1.11] apply_upgrade() on train via script or robot disconnects on junction
Posted: Wed Jul 15, 2026 3:41 am
When a train is parked on a junction of a straight and curved track, only placing an upgrade manually is guaranteed to reconnect to the train properly. Both robots and scripts can end up on the wrong track and not couple to the original train, even though an in-place upgrade was ordered.
Steps to reproduce:
1. Load the attached save.
2. Take the Epic Locomotive from your hotbar and place it on the right-most locomotive. Observe that the locomotive remains coupled to the train. This is expected.
3. Reload the attached save.
4. Take the Rare Locomotive Upgrade Planner from your hotbar and order an upgrade of the right-most locomotive to order an upgrade. Observe that after the construction bot places it, the locomotive becomes uncoupled from the train. I expected it to remain coupled.
5. Reload the attached save.
6. Disable your personal roboport.
7. Take the Rare Locomotive Upgrade Planner from your hotbar and order an upgrade of the right-most locomotive to order an upgrade.
8. Select the to-be-upgraded locomotive and run the following command: /c game.player.selected.apply_upgrade(). Observe that the locomotive becomes uncoupled from the train. I expected it to remain coupled.
9. Reload the attached save.
10. Select the right-most locomotive and run the following command: /c game.player.selected.apply_upgrade({name="locomotive", quality="rare"}). Observe that the locomotive becomes uncoupled from the train. I expected it to remain coupled.
FYI, using create_entity has always done the same thing, disconnecting the train on certain junctions. I was hoping that apply_upgrade would fix this problem, which continues to cause issues with Multiple Unit Train Control and Vehicle Wagon.
Steps to reproduce:
1. Load the attached save.
2. Take the Epic Locomotive from your hotbar and place it on the right-most locomotive. Observe that the locomotive remains coupled to the train. This is expected.
3. Reload the attached save.
4. Take the Rare Locomotive Upgrade Planner from your hotbar and order an upgrade of the right-most locomotive to order an upgrade. Observe that after the construction bot places it, the locomotive becomes uncoupled from the train. I expected it to remain coupled.
5. Reload the attached save.
6. Disable your personal roboport.
7. Take the Rare Locomotive Upgrade Planner from your hotbar and order an upgrade of the right-most locomotive to order an upgrade.
8. Select the to-be-upgraded locomotive and run the following command: /c game.player.selected.apply_upgrade(). Observe that the locomotive becomes uncoupled from the train. I expected it to remain coupled.
9. Reload the attached save.
10. Select the right-most locomotive and run the following command: /c game.player.selected.apply_upgrade({name="locomotive", quality="rare"}). Observe that the locomotive becomes uncoupled from the train. I expected it to remain coupled.
FYI, using create_entity has always done the same thing, disconnecting the train on certain junctions. I was hoping that apply_upgrade would fix this problem, which continues to cause issues with Multiple Unit Train Control and Vehicle Wagon.