Add requiredMods to plugin declarations

Plugins can list the Factorio mods they need under requiredMods. When an
instance starts, the host warns in the instance log about each loaded
plugin whose required mods are missing or disabled in the mod pack.
Subspace Storage declares the subspace_storage mod.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-19 15:07:06 +00:00
1 parent eefb4be44b
commit a845b7ac52
6 files changed
+75

No files matched your search

+18
View File
@@ -1032,6 +1032,24 @@ end`.replace(/\r?\n/g, " ");
}
await this.syncMods();
this.checkRequiredMods(this.activeModPack);
}
/**
* Warn about mods required by loaded plugins that the mod pack lacks
*/
checkRequiredMods(modPack: lib.ModPack) {
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.`
);
}
}
}
/**
+2
View File
@@ -41,6 +41,8 @@ export type PluginDeclaration = {
migrationEntrypoint?: string;
features?: (typeof PluginFeatureFlags)[number][];
/** Names of Factorio mods the plugin needs in the instance's mod pack */
requiredMods?: string[];
messages?: any[];
errors?: ErrorClass[];