Updated mods updater script to correctly process mod releases #557
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.
The script should correctly process mod releases
The updated script goes through each version reverse sorted by release date, then performs some checks.
If the check fails, it continues to the next release until the correct release found. The logic is the same for the case, if no release was found.
First, it checks Factorio version vs mod Factorio version.
If Major version differs, it skips it.
If Minor version is less, also skips.
Then it goes through the optional dependencies element and checks it with game version, for
base
dependencies.If the dependency rule is false, it skips it.
Checked script on my own modpack, and the
jetpack
mod was downgraded to the correct version for 2.0.21, everything else updated correctly. DLC mods also were ignored because they are for version 1.1Disclaimer:
I am not proficient with bash scripting, so I made the changes with the help of ChatGPT.
Also, I haven't added any advanced logic to the main mod Factiorio version check.
So the updater won't correctly update mods for this case, leaving old versions: