Skip to content

Update data-final-fixes.lua#69

Open
Cbow2018 wants to merge 2 commits into
robot256:V2.1supportfrom
Cbow2018:V2.1support
Open

Update data-final-fixes.lua#69
Cbow2018 wants to merge 2 commits into
robot256:V2.1supportfrom
Cbow2018:V2.1support

Conversation

@Cbow2018

Copy link
Copy Markdown

Fixes issue #68 Factorio 2.1 added validation that rolling stock and its next_upgrade target must share the same connection_distance. Ship rolling stock is deepcopied from the vanilla prototypes in prototypes/ships.lua (boat and cargo_ship from cargo-wagon, oil_tanker from fluid-wagon, boat_engine and cargo_ship_engine from locomotive) and then overrides connection_distance. Bob's Logistics 3.0.0 ("Enabled automatic train upgrading", 2026-06-29) sets next_upgrade on those vanilla prototypes in place at the data stage, so the deepcopies inherit it and fail validation. This clears next_upgrade on the five ship rolling stock prototypes at data-final-fixes, following the existing pattern used for bridge, invisible_rail and floating_pole. Why data-final-fixes rather than clearing it in ships.lua: clearing at the point of deepcopy would only catch mods that set next_upgrade during the data stage. Doing it in final-fixes also covers mods that add it during data-updates. Happy to move it if you'd rather keep the logic local to ships.lua. Tested on Factorio 2.1.11 with Bob's Logistics 3.0.0 + Krastorio 2 + Space Age; loads cleanly with the patch, fails without it.

Fixes issue robot256#68 Factorio 2.1 added validation that rolling stock and its next_upgrade target must share the same connection_distance. Ship rolling stock is deepcopied from the vanilla prototypes in prototypes/ships.lua (boat and cargo_ship from cargo-wagon, oil_tanker from fluid-wagon, boat_engine and cargo_ship_engine from locomotive) and then overrides connection_distance. Bob's Logistics 3.0.0 ("Enabled automatic train upgrading", 2026-06-29) sets next_upgrade on those vanilla prototypes in place at the data stage, so the deepcopies inherit it and fail validation.
This clears next_upgrade on the five ship rolling stock prototypes at data-final-fixes, following the existing pattern used for bridge, invisible_rail and floating_pole.
Why data-final-fixes rather than clearing it in ships.lua: clearing at the point of deepcopy would only catch mods that set next_upgrade during the data stage. Doing it in final-fixes also covers mods that add it during data-updates. Happy to move it if you'd rather keep the logic local to ships.lua.
Tested on Factorio 2.1.11 with Bob's Logistics 3.0.0 + Krastorio 2 + Space Age; loads cleanly with the patch, fails without it.
@robot256

Copy link
Copy Markdown
Owner

Hi, thanks for the PR. Yes, please move the next_upgrade clearing to the data stage right after deepcopy. That way if a mod adds it back in (because they add a compatible upgrade target) it won't get erased.

@Cbow2018

Copy link
Copy Markdown
Author

Good point. I have added it at the moment of copy so this leaves next_upgrade from a compat mod. It has been moved to prototypes/ships.lua right after each deepcopy and reverted from data-final-fixes.lua change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants