diff --git a/Yafc.Parser/FactorioDataSource.cs b/Yafc.Parser/FactorioDataSource.cs index a92cb74b..c694a063 100644 --- a/Yafc.Parser/FactorioDataSource.cs +++ b/Yafc.Parser/FactorioDataSource.cs @@ -176,13 +176,14 @@ public static Project Parse(string factorioPath, string modPath, string projectP string modListPath = Path.Combine(modPath, "mod-list.json"); Dictionary versionSpecifiers = []; - if (File.Exists(modListPath)) { + bool hasModList = File.Exists(modListPath); + if (hasModList) { var mods = JsonSerializer.Deserialize(File.ReadAllText(modListPath)) ?? throw new($"Could not read mod list from {modListPath}"); allMods = mods.mods.Where(x => x.enabled).Select(x => x.name).ToDictionary(x => x, x => (ModInfo)null!); versionSpecifiers = mods.mods.Where(x => x.enabled && !string.IsNullOrEmpty(x.version)).ToDictionary(x => x.name, x => Version.Parse(x.version!)); // null-forgiving: null version strings are filtered by the Where. } else { - allMods = new Dictionary { { "base", null! }, { "elevated-rails", null! }, { "quality", null! }, { "space-age", null! } }; + allMods = new Dictionary { { "base", null! } }; } allMods["core"] = null!; @@ -198,6 +199,18 @@ public static Project Parse(string factorioPath, string modPath, string projectP FindMods(modPath, progress, allFoundMods); } + if (!hasModList) { + // Check if the Space Age DLC mods are available, as the game will enable them by default when available. + bool foundSpaceAge = allFoundMods.Exists(modInfo => modInfo.name == "space-age"); + if (foundSpaceAge) { + // Add space-age mod ... + allMods.Add("space-age", null!); + // ... and its dependencies + allMods.Add("quality", null!); + allMods.Add("elevated-rails", null!); + } + } + Version? factorioVersion = null; foreach (var mod in allFoundMods) { diff --git a/changelog.txt b/changelog.txt index 932bcd62..701b8413 100644 --- a/changelog.txt +++ b/changelog.txt @@ -23,6 +23,7 @@ Date: Bugfixes: - Recipes no longer have excessive question marks in their names - Moved mining and research bonuses have to the Preferences screen. + - Support games without the Space Age DLC again. Internal changes: - Added rudimentary tools for drawing tab controls. ----------------------------------------------------------------------------------------------------------------------