Update data-final-fixes.lua#69
Open
Cbow2018 wants to merge 2 commits into
Open
Conversation
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.
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. |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.