mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-20 15:33:12 +09:00
Join messages were stored in exp_legacy's PlayerData, which nothing ever synced. The controller now keeps a players.json datastore of per-player settings keyed by player name, starting with the join message, and saves it on the save and shutdown hooks. Records with nothing set are removed. When a player joins, the instance plugin fetches their record and prints the message to everyone over rcon in the player's colour, so no lua is needed to show it. The in-game /set-join-message and /remove-join-message commands send ipc which the instance forwards to the controller; /set-join-message without a message asks the instance, which prints the stored message back to the player. Greetings is now a feature. Disabling it stops the greeting, the commands, and the printed join messages. The private greeting with the community name and Discord link is shown to every joining player, even those with a join message, since one is a welcome for the player and the other an announcement to everyone else. Two controller permissions cover the web interface: exp_scenario.join_message.set for your own message and .set_other for anyone's, checked against the requesting user the same way exp_discord_auth checks unlinking. The seed grants them to Supporter and Moderator alongside the in-game commands. The user page gets a Scenario section showing the message with an edit button for users who may change it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.0 KiB
TypeScript
66 lines
2.0 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;
|
|
"exp_scenario.join_message.set": never;
|
|
"exp_scenario.join_message.set_other": never;
|
|
}
|
|
}
|
|
|
|
export const plugin: lib.PluginDeclaration = {
|
|
name: "exp_scenario",
|
|
title: "ExpGaming - Scenario",
|
|
description: "Clusterio plugin implementing the Explosive Gaming scenario.",
|
|
controllerEntrypoint: "./dist/node/controller.js",
|
|
instanceEntrypoint: "./dist/node/instance.js",
|
|
|
|
messages: [
|
|
messages.SeedRequest,
|
|
messages.FeatureUpdatedEvent,
|
|
messages.FeatureListRequest,
|
|
messages.FeatureUpdateRequest,
|
|
messages.PlayerGetRequest,
|
|
messages.JoinMessageSetRequest,
|
|
],
|
|
|
|
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",
|
|
},
|
|
{
|
|
name: "exp_scenario.join_message.set",
|
|
title: "Set own join message",
|
|
description: "Set the message shown to everyone when you join, in game this is /set-join-message",
|
|
},
|
|
{
|
|
name: "exp_scenario.join_message.set_other",
|
|
title: "Set join messages of others",
|
|
description: "Set the message shown to everyone when another user joins",
|
|
},
|
|
],
|
|
|
|
webEntrypoint: "./web",
|
|
routes: [
|
|
"/scenario_features",
|
|
],
|
|
};
|