mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-15 08:24:52 +09:00
Features can now be enabled, disabled, and configured from the web UI while the game is running, without editing Lua files. The first five features covered are AFK Kick, Chat Auto Reply, Death Markers, Mine Depletion, and Station Auto Name. Lua side: module/features.lua holds each feature's defaults, keeps the overrides from the controller in storage, and patches them onto the config table in place. Features.guard skips a feature's handlers while it is disabled. The five config files move from exp_legacy into exp_scenario/module/config and their control files now read config at runtime instead of deciding at load which handlers to register. AFK Kick times are now in minutes. Controller side: features.ts lists the editable settings and their defaults. Overrides that differ from the default are stored in exp_scenario/features.json and guarded by the existing exp_scenario.config.view/edit permissions. The instance plugin sends them over rcon on start, on every change, and again after the controller restarts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import * as lib from "@clusterio/lib";
|
|
import * as messages from "./messages.js";
|
|
import { permissions as scenarioPermissions, type ScenarioPermissionName } from "./permissions.js";
|
|
|
|
declare module "@clusterio/lib" {
|
|
// Everything checked in game through exp_roles, plus the permissions checked on the controller
|
|
export interface Permissions extends Record<ScenarioPermissionName, never> {
|
|
"exp_scenario.config.view": never;
|
|
"exp_scenario.config.edit": never;
|
|
"exp_scenario.seed": never;
|
|
}
|
|
}
|
|
|
|
export const plugin: lib.PluginDeclaration = {
|
|
name: "exp_scenario",
|
|
title: "exp_scenario",
|
|
description: "Example Description. Plugin. Change me in index.ts",
|
|
controllerEntrypoint: "./dist/node/controller.js",
|
|
instanceEntrypoint: "./dist/node/instance.js",
|
|
|
|
messages: [
|
|
messages.SeedRequest,
|
|
messages.FeatureUpdatedEvent,
|
|
messages.FeatureListRequest,
|
|
messages.FeatureUpdateRequest,
|
|
],
|
|
|
|
permissions: [
|
|
...scenarioPermissions,
|
|
{
|
|
name: "exp_scenario.config.view",
|
|
title: "View ExpScenario Config",
|
|
description: "View the config for all submodules of ExpScenario",
|
|
},
|
|
{
|
|
name: "exp_scenario.config.edit",
|
|
title: "Edit ExpScenario Config",
|
|
description: "Edit the config for all submodules of ExpScenario",
|
|
},
|
|
{
|
|
name: "exp_scenario.seed",
|
|
title: "Seed ExpScenario roles and groups",
|
|
description: "Create the roles and permission groups the scenario shipped with",
|
|
},
|
|
],
|
|
|
|
webEntrypoint: "./web",
|
|
routes: [
|
|
"/scenario_features",
|
|
],
|
|
};
|