Update config of running Factorio instances

Monitor the factorio.settings config for changes and apply them to
running instances via the /config set command.
This commit is contained in:
Hornwitser committed 2020-05-31 22:28:51 +02:00
1 parent 5b043524b4
commit 931ad4816f
8 files changed
+274 -51

No files matched your search

+20
View File
@@ -223,6 +223,26 @@ commands.push(new Command({
},
}));
commands.push(new Command({
definition: ["set-instance-config-prop", "Set property of field in instance config", (yargs) => {
yargs.option({
"instance": { describe: "Instance to set config on", nargs: 1, type: "string", demandOption: true },
"field": { describe: "Field to set", nargs: 1, type: "string", demandOption: true },
"prop": { describe: "Property to set", nargs: 1, type: "string", demandOption: true },
"value": { describe: "JSON parsed value to set", nargs: 1, type: "string", demandOption: true },
});
}],
handler: async function(args, control) {
let instanceId = await resolveInstance(control, args.instance);
await link.messages.setInstanceConfigProp.send(control, {
instance_id: instanceId,
field: args.field,
prop: args.prop,
value: JSON.parse(args.value),
});
},
}));
commands.push(new Command({
definition: ['assign-instance', "Assign instance to a slave", (yargs) => {
yargs.options({