Compare commits

...

3 Commits

Author SHA1 Message Date
99c446e607 Fix duplicate mod error with Space Age DLC mods (#576)
Skip downloading built-in DLC mods (elevated-rails, quality, space-age) when UPDATE_MODS_ON_START is enabled. These mods are included with the Space Age DLC and attempting to download them separately causes "Duplicate mod" errors.

- Modified update-mods.sh to skip DLC built-in mods during updates
- Added documentation note explaining the automatic handling of DLC mods

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 21:47:54 +09:00
23942e3117 Auto Update Factorio to stable version: 2.0.55 experimental version: 2.0.59 2025-07-09 10:29:10 +00:00
15d38ea739 Fix mod version compatibility checking for major version differences (#575)
This fixes issue #517 where the auto mod updater was downloading the wrong
mod versions after updating to Space Age (Factorio 2.0). The problem was that
the version checking logic was incorrectly rejecting compatible mod versions.

Changes:
- Fixed check_game_version() to properly handle major version differences
- Game versions can now run mods designed for older major versions (backward compatibility)
- Game versions correctly reject mods requiring newer versions
- Fixed variable references in check_dependency_version()
- Added clarifying comments about the version checking behavior

This also addresses issue #468 by ensuring mods requiring newer Factorio
versions than currently installed are properly skipped.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-06 19:01:05 +09:00
3 changed files with 49 additions and 16 deletions

View File

@ -6,8 +6,17 @@
[中文](./README_zh_CN.md)
<!-- start autogeneration tags -->
* `latest, 2.0.58`
* `latest, 2.0.59`
* `2, 2.0, 2.0.55, stable, stable-2.0.55`
* `2.0.58`
* `stable-1.1.110, 1, 1.1, 1.1.110`
* `1.0.0, 1.0`
* `0.17.79, 0.17`
* `0.16.51, 0.16`
* `0.15.40, 0.15`
* `0.14.23, 0.14`
* `0.13.20, 0.13`
* `0.12.35, 0.12`
<!-- end autogeneration tags -->
## Tag descriptions
@ -175,6 +184,8 @@ Copy mods into the mods folder and restart the server.
As of 0.17 a new environment variable was added ``UPDATE_MODS_ON_START`` which if set to ``true`` will cause the mods get to updated on server start. If set a valid [Factorio Username and Token](https://www.factorio.com/profile) must be supplied or else the server will not start. They can either be set as docker secrets, environment variables, or pulled from the server-settings.json file.
**Note:** When using the Space Age DLC, the built-in mods (`elevated-rails`, `quality`, and `space-age`) are automatically skipped during mod updates to prevent conflicts. These mods are included with the DLC and should not be downloaded separately.
### Scenarios
If you want to launch a scenario from a clean start (not from a saved map) you'll need to start the docker image from an alternate entrypoint. To do this, use the example entrypoint file stored in the /factorio/entrypoints directory in the volume, and launch the image with the following syntax. Note that this is the normal syntax with the addition of the --entrypoint setting AND the additional argument at the end, which is the name of the Scenario in the Scenarios folder.

View File

@ -356,8 +356,14 @@
"2.0.58": {
"sha256": "be82e1aeba4169420e1b00c12a3e00ec2309a41327f9d6c335feec27bbc885e6",
"tags": [
"latest",
"2.0.58"
]
},
"2.0.59": {
"sha256": "fdc467bf80e3611d6dd08c79492228ffec53f3fe914f24d793cac254d9353ff7",
"tags": [
"latest",
"2.0.59"
]
}
}

View File

@ -23,24 +23,33 @@ print_failure()
echo "$1"
}
# Checks game version vs version in mod.
# Returns 0 if major version differs or mod minor version is less than game version, 1 if ok
# Checks if the current game version satisfies the mod's minimum required version.
# Returns 1 if the game version is compatible with the mod, 0 if not
check_game_version() {
local game_version="$1"
local mod_version="$2"
local mod_required_version="$1" # The minimum Factorio version required by the mod
local current_game_version="$2" # The current Factorio version
local game_major mod_major game_minor mod_minor
game_major=$(echo "$game_version" | cut -d '.' -f1)
game_minor=$(echo "$game_version" | cut -d '.' -f2)
mod_major=$(echo "$mod_version" | cut -d '.' -f1)
mod_minor=$(echo "$mod_version" | cut -d '.' -f2)
local mod_major mod_minor game_major game_minor
mod_major=$(echo "$mod_required_version" | cut -d '.' -f1)
mod_minor=$(echo "$mod_required_version" | cut -d '.' -f2)
game_major=$(echo "$current_game_version" | cut -d '.' -f1)
game_minor=$(echo "$current_game_version" | cut -d '.' -f2)
if [[ "$game_major" -ne "$mod_major" ]]; then
# If game major version is greater than mod's required major version, it's compatible
if [[ "$game_major" -gt "$mod_major" ]]; then
echo 1
return
fi
# If game major version is less than mod's required major version, it's not compatible
if [[ "$game_major" -lt "$mod_major" ]]; then
echo 0
return
fi
if [[ "$mod_minor" -ge "$game_minor" ]]; then
# Major versions are equal, check minor versions
# Game minor version must be >= mod's required minor version
if [[ "$game_minor" -ge "$mod_minor" ]]; then
echo 1
else
echo 0
@ -79,7 +88,7 @@ check_dependency_version()
fi
;;
">")
if [[ "$(printf '%s\n%s\n' "$required_version" "$mod_version" | sort -V | head -n1)" == "$required_version" && "$required_version" != "$FACTORIO_VERSION" ]]; then
if [[ "$(printf '%s\n%s\n' "$required_version" "$mod_version" | sort -V | head -n1)" == "$required_version" && "$required_version" != "$mod_version" ]]; then
echo 1
else
echo 0
@ -93,7 +102,7 @@ check_dependency_version()
fi
;;
"<")
if [[ "$(printf '%s\n%s\n' "$required_version" "$mod_version" | sort -V | tail -n1)" == "$required_version" && "$required_version" != "$FACTORIO_VERSION" ]]; then
if [[ "$(printf '%s\n%s\n' "$required_version" "$mod_version" | sort -V | tail -n1)" == "$required_version" && "$required_version" != "$mod_version" ]]; then
echo 1
else
echo 0
@ -116,11 +125,15 @@ get_mod_info()
{
local mod_info_json="$1"
# Process mod releases from newest to oldest, looking for a compatible version
while IFS= read -r mod_release_info; do
local mod_version mod_factorio_version
mod_version=$(echo "$mod_release_info" | jq -r ".version")
mod_factorio_version=$(echo "$mod_release_info" | jq -r ".info_json.factorio_version")
# Check if this mod version is compatible with our Factorio version
# This prevents downloading mods that require a newer Factorio version (fixes #468)
# and ensures backward compatibility (e.g., Factorio 2.0 can use 1.x mods) (fixes #517)
if [[ $(check_game_version "$mod_factorio_version" "$FACTORIO_VERSION") == 0 ]]; then
echo " Skipping mod version $mod_version because of factorio version mismatch" >&2
continue
@ -214,9 +227,12 @@ update_mod()
return 0
}
# Process all enabled mods from mod-list.json, but skip built-in mods
# The Space Age DLC includes built-in mods (elevated-rails, quality, space-age) that should not be downloaded
if [[ -f $MOD_DIR/mod-list.json ]]; then
jq -r ".mods|map(select(.enabled))|.[].name" "$MOD_DIR/mod-list.json" | while read -r mod; do
if [[ $mod != base ]]; then
# Skip base mod and DLC built-in mods
if [[ $mod != base ]] && [[ $mod != elevated-rails ]] && [[ $mod != quality ]] && [[ $mod != space-age ]]; then
update_mod "$mod" || true
fi
done