Merge pull request #1183 from bbassie/fix/save-patching-plugin-default

Default load_plugin to off when the instance lacks required features
This commit is contained in:
Bastiaan authored and GitHub committed 2026-11-04 01:19:10 +00:00
1 parent 308cca9b7d
commit 4a2c164188
9 files changed
+99 -42

No files matched your search

+4 -4
View File
@@ -269,13 +269,13 @@ export default class InstanceManager {
) as InheritableField[];
}
/** Default value of a field, or undefined if it is generated */
private static _defaultValue(name: InheritableField): unknown {
/** Default value of a field for the given config */
private static _defaultValue(name: InheritableField, config: lib.InstanceConfig): unknown {
const def = lib.InstanceConfig.fieldDefinitions[name];
if (name === "factorio.settings") {
return InstanceManager.DefaultFactorioSettings;
}
return typeof def.initialValue === "function" ? undefined : def.initialValue ?? null;
return typeof def.initialValue === "function" ? def.initialValue(config) : def.initialValue ?? null;
}
/** Values the given inherited fields take from the template, with object overrides applied */
@@ -345,7 +345,7 @@ export default class InstanceManager {
for (const name of InstanceManager._inheritableFields()) {
const value = instance.config.get(name) as any;
const templateValue = template.config.get(name) as any;
const defaultValue = InstanceManager._defaultValue(name) as any;
const defaultValue = InstanceManager._defaultValue(name, instance.config) as any;
if (lib.InstanceConfig.fieldDefinitions[name].type === "object") {
inherited[name] = Object.keys(value ?? {}).filter(prop => !(
isDeepStrictEqual(value[prop], templateValue?.[prop])