mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-12 16:35:11 +09:00
- Use the core role permissions rather than defining new ones. Assignments are only sent between the controller and an instance, so they are no longer addressed to control and need no permission at all. - Split the datastore reconciliation into ensureRoleMeta, sweepRoleMeta and applyAutoAssign, all run on init as well as when roles change. Properties left behind by a role deleted while the plugin was not running are now swept up, where before they would be inherited by the next role given that id. - Use a switch in onControllerConfigFieldChanged, matching instance.ts. - Resolve pending assignments on initialise. A pending role is either confirmed, and so now held by synced_players, or it never landed; either way it stops being held locally. Roles assigned with assign_player_local are untouched. - Drop the emit_updates juggling in reject_assignment, sync is already false. - Send each permission name once and reference it by index, see the benchmark in the pull request. Single role updates stay in the plain form. - Lay the role properties out in columns, name the apply button for the section it belongs to, and give every field a tooltip. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import * as lib from "@clusterio/lib";
|
|
import * as messages from "./messages";
|
|
|
|
declare module "@clusterio/lib" {
|
|
export interface InstanceConfigFields {
|
|
"exp_roles.sync_mode": "disabled" | "enabled" | "bidirectional";
|
|
}
|
|
}
|
|
|
|
// The in game properties of a role are part of the role, so they are covered by
|
|
// the core role permissions rather than permissions of their own. Assignments
|
|
// are only ever sent between the controller and an instance, so they need none.
|
|
|
|
export const plugin: lib.PluginDeclaration = {
|
|
name: "exp_roles",
|
|
title: "ExpGaming - Roles",
|
|
description: "Clusterio plugin providing syncing of in game roles",
|
|
|
|
features: [
|
|
"SavePatching",
|
|
"ScriptCommands",
|
|
],
|
|
|
|
messages: [
|
|
messages.RoleUpdatedEvent,
|
|
messages.AssignmentUpdatedEvent,
|
|
|
|
messages.RoleListRequest,
|
|
messages.RoleMetaUpdateRequest,
|
|
|
|
messages.AssignmentListRequest,
|
|
messages.AssignmentUpdateRequest,
|
|
],
|
|
|
|
instanceEntrypoint: "./dist/node/instance",
|
|
instanceConfigFields: {
|
|
"exp_roles.sync_mode": {
|
|
description: "Synchronize in game roles with the controller",
|
|
type: "string",
|
|
enum: ["disabled", "enabled", "bidirectional"],
|
|
initialValue: "bidirectional",
|
|
},
|
|
},
|
|
|
|
controllerEntrypoint: "./dist/node/controller",
|
|
controllerConfigFields: {
|
|
},
|
|
|
|
webEntrypoint: "./web",
|
|
};
|