mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-24 15:33:13 +09:00
Add exp_auto_restart plugin
Restarts hosts, and optionally the controller, that report a pending restart once no players have been online for a configurable time. Only loaded on the controller: it counts players from the users online on running instances, sends HostRestartRequest through the existing core path, and starts the instances that were running once the host reports back. Each host process is asked at most once, keyed on its process start time, so a stale system info poll cannot trigger a second restart. Uses the function-style entrypoint clusterio now documents, so it loads without the deprecated class export warning. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
06fc1086e3
commit
5a6f3b46fe
8 files changed
+773
No files matched your search
@@ -0,0 +1,50 @@
|
||||
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,
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user