mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
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:
1 parent
a845b7ac52
commit
bf33f4f52e
12 files changed
+437
-240
No files matched your search
+12
-6
@@ -152,7 +152,7 @@ The following properties are recognized:
|
||||
See [Handling Invalid Configuration](#handling-invalid-configuration)
|
||||
|
||||
**requiredMods**:
|
||||
Array of names of Factorio mods the plugin needs in the mod pack of the instances it is loaded on.
|
||||
Array of Factorio mods the plugin needs in the mod pack of the instances it is loaded on, written as Factorio dependency strings.
|
||||
See [Handling Invalid Configuration](#handling-invalid-configuration)
|
||||
|
||||
**messages**:
|
||||
@@ -325,18 +325,24 @@ export const plugin = {
|
||||
Enabling the plugin on an instance that has the feature turned off then fails config validation, so the mistake is caught when the config is edited instead of when the instance starts.
|
||||
Instances that have the feature turned off get the plugin disabled by default when it is added.
|
||||
|
||||
If the plugin talks to a Factorio mod, list the mod under `requiredMods`:
|
||||
If the plugin talks to a Factorio mod, list the mod under `requiredMods` using the same format as `dependencies` in a mod's info.json, without a prefix.
|
||||
List a mod twice to give a version range:
|
||||
|
||||
```js
|
||||
export const plugin = {
|
||||
name: "subspace_storage",
|
||||
name: "foo_frobber",
|
||||
// ...
|
||||
requiredMods: ["subspace_storage"],
|
||||
requiredMods: ["frobber >= 1.2.0", "frobber < 2.0.0"],
|
||||
};
|
||||
```
|
||||
|
||||
When an instance with the plugin loaded starts with a mod pack that does not have the mod enabled, the host logs a warning to the instance log naming the missing mods.
|
||||
The mods are not added automatically, and the instance still starts.
|
||||
An instance with the plugin loaded refuses to start if its mod pack is missing one of the mods, has it disabled, or has a version outside the range.
|
||||
Leave out the dependencies of the required mods. Factorio checks those itself.
|
||||
When the controller starts it downloads required mods it does not have, and their dependencies, from the mod portal for the Factorio version of the default mod pack.
|
||||
This needs `controller.factorio_username` and `controller.factorio_token` to be set.
|
||||
The mods still have to be added to the mod packs by hand.
|
||||
|
||||
Forks of a required mod are not supported.
|
||||
|
||||
Other constraints on config fields are expressed with a `validator` on the field definition, which throws when the value is not acceptable.
|
||||
Use `dependsOn` when the check involves other fields so that the validator runs when those change too.
|
||||
|
||||
Reference in new issue
Block a user