Files
factorio-expcluster/exp_auto_restart/index.ts
T
bbassieandClaude Opus 5.5 8dbe1b4a19 Drop the empty web entrypoint from exp_auto_restart
web/index.tsx is empty, so the web UI failed to load the plugin with
"must export either a default function or WebPlugin". Plugins without a
web UI, like clusterio's statistics_exporter, keep the empty file only as
the webpack entry and expose just the plugin info and package.json. That
is still enough for the web UI to show and edit the plugin's controller
config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 00:13:38 +00:00

51 lines
1.5 KiB
TypeScript

import * as lib from "@clusterio/lib";
declare module "@clusterio/lib" {
export interface ControllerConfigFields {
"exp_auto_restart.idle_seconds": number;
"exp_auto_restart.scope": "host" | "cluster";
"exp_auto_restart.start_instances": boolean;
"exp_auto_restart.restart_controller": boolean;
}
}
export const plugin: lib.PluginDeclaration = {
name: "exp_auto_restart",
title: "ExpGaming - Auto Restart",
description: "Clusterio plugin restarting hosts and the controller once no players are online",
controllerEntrypoint: "./dist/node/controller.js",
controllerConfigFields: {
"exp_auto_restart.idle_seconds": {
title: "Idle Seconds",
description: "How long a host must have had no players online before it is restarted",
type: "number",
initialValue: 300,
validator: (value: number) => {
if (value < 0) {
throw new Error("Idle seconds cannot be negative");
}
},
},
"exp_auto_restart.scope": {
title: "Scope",
description: "Whether players on other hosts also hold back a restart",
type: "string",
enum: ["host", "cluster"],
initialValue: "host",
},
"exp_auto_restart.start_instances": {
title: "Start Instances",
description: "Start the instances that were running again once the host is back",
type: "boolean",
initialValue: true,
},
"exp_auto_restart.restart_controller": {
title: "Restart Controller",
description: "Also restart the controller when it needs it and no players are online anywhere",
type: "boolean",
initialValue: false,
},
},
};