Refuse to start without required mods and download them

requiredMods entries are now Factorio dependency strings, and a mod
listed twice gives a version range. The plugin loader validates them.

The host refuses to start an instance whose mod pack is missing a
required mod of a loaded plugin, has it disabled or has it outside the
version range.

On start the controller resolves the required mods of its plugins and
their dependencies for the default mod pack's Factorio version and
downloads the ones missing from the mod store. The resolver and portal
download move from the ControlConnection handlers into Controller
methods so both paths share them.

Subspace Storage requires subspace_storage >= 1.99.0, and the
integration tests build a stub of that mod for the test mod pack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-19 15:19:05 +00:00
1 parent a845b7ac52
commit bf33f4f52e
12 files changed
+437 -240

No files matched your search

+24 -9
View File
@@ -1036,19 +1036,34 @@ end`.replace(/\r?\n/g, " ");
}
/**
* Warn about mods required by loaded plugins that the mod pack lacks
* Check that the mod pack has the mods required by the loaded plugins
*
* @throws {lib.ConflictError} if a required mod is missing, disabled or the wrong version.
*/
checkRequiredMods(modPack: lib.ModPack) {
const problems = [];
for (const pluginInfo of this.loadedPlugins) {
const missing = (pluginInfo.requiredMods ?? []).filter(name => !modPack.mods.get(name)?.enabled);
if (missing.length) {
this.logger.warn(
`Plugin ${pluginInfo.name} requires ${missing.join(", ")} which ` +
`${missing.length === 1 ? "is" : "are"} not enabled in mod pack ${modPack.name}. ` +
`Add ${missing.length === 1 ? "it" : "them"} to the mod pack or set ` +
`${pluginInfo.name}.load_plugin to false for this instance.`
);
const unmet = [];
for (const dependency of lib.pluginRequiredMods(pluginInfo)) {
const mod = modPack.mods.get(dependency.name);
if (!mod) {
unmet.push(`${dependency.spec} (missing)`);
} else if (!mod.enabled) {
unmet.push(`${dependency.spec} (disabled)`);
} else if (dependency.version && !dependency.version.testVersion(mod.version)) {
unmet.push(`${dependency.spec} (found ${mod.version})`);
}
}
if (unmet.length) {
problems.push(`Plugin ${pluginInfo.name} requires ${unmet.join(", ")}.`);
}
}
if (problems.length) {
throw new lib.ConflictError(
`Mod pack ${modPack.name} does not have the mods required by the loaded plugins. ` +
`${problems.join(" ")} ` +
"Add the mods to the mod pack or set <plugin>.load_plugin to false for this instance."
);
}
}