Commit Graph
3037 Commits
Author SHA1 Message Date
phidias 01845fead7 a (#44)
* .

* .

* .

* .

* compilatron

* .

* .

* .

* .

* links

* .

* .

* .

* Update tsconfig.browser.json
2026-09-10 17:04:06 +09:00
phidiasandWeblate 23ee68c50a Further locale change (#471)
* chore(l10n): update translation files

Add-on: Cleanup translation files
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.aperx.org/projects/expcluster/expscenario/
Translation: ExpCluster/ExpScenario

* Update readme.lua

* links

* readme

* chore(l10n): update English translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update English translation

Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: phidias <phidias@aperx.org>
Language: Chinese (Simplified Han script)
Language: Chinese (Traditional Han script)
Language: English
Progress: 100.0% (1 of 1 strings)
Progress: 100.0% (2 of 2 strings)
Progress: 100.0% (233 of 233 strings)
Progress: 100.0% (4 of 4 strings)
Translate-URL: https://translate.aperx.org/projects/expcluster/explegacy/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/explegacy/zh_Hant/
Translate-URL: https://translate.aperx.org/projects/expcluster/exprole/en/
Translate-URL: https://translate.aperx.org/projects/expcluster/exprole/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/exprole/zh_Hant/
Translate-URL: https://translate.aperx.org/projects/expcluster/expserverups/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/expserverups/zh_Hant/
Translate-URL: https://translate.aperx.org/projects/expcluster/exputil/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/exputil/zh_Hant/
Translation: ExpCluster/ExpLegacy
Translation: ExpCluster/ExpRole
Translation: ExpCluster/ExpServerUPS
Translation: ExpCluster/ExpUtil

* chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update English translation

Co-authored-by: phidias <phidias@aperx.org>
Language: Chinese (Simplified Han script)
Language: Chinese (Traditional Han script)
Language: English
Progress: 100.0% (452 of 452 strings)
Progress: 95.7% (433 of 452 strings)
Translate-URL: https://translate.aperx.org/projects/expcluster/expscenario/en/
Translate-URL: https://translate.aperx.org/projects/expcluster/expscenario/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/expscenario/zh_Hant/
Translation: ExpCluster/ExpScenario

* chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

Co-authored-by: phidias <phidias@aperx.org>
Language: Chinese (Simplified Han script)
Language: Chinese (Traditional Han script)
Progress: 95.7% (433 of 452 strings)
Translate-URL: https://translate.aperx.org/projects/expcluster/expscenario/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/expscenario/zh_Hant/
Translation: ExpCluster/ExpScenario

---------

Co-authored-by: Weblate <noreply@weblate.org>
2026-09-09 18:43:29 +01:00
Cooldude2606andClaude Fable 5.1 910285ee2d Reference exp_roles and exp_groups from the exp_scenario build (#473)
* Reference exp_roles and exp_groups from the exp_scenario build

exp_scenario imports types from @expcluster/roles and
@expcluster/permission-groups through their dist folders, so building it
on its own before those packages are built fails with TS2307. A plain
pnpm install runs the prepare scripts in dependency order, but a filtered
install or running tsc --build in exp_scenario on a fresh clone does not.
Referencing the node projects of both packages makes tsc build them first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Export messages and controller types from exp_roles and exp_groups

exp_scenario reached into @expcluster/roles/dist/node/* for the message
classes and the controller plugin type. The package index now re-exports
messages and the ControllerPlugin type, so consumers import from the
package name like they do with @clusterio/lib. The controller export is
type only, which keeps node code out of the web bundle. The test still
requires the controller classes from dist since they cannot be
re-exported at runtime.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 18:42:18 +01:00
bbassieandClaude Fable 5.1 51786c5df9 Export messages and controller types from exp_roles and exp_groups
exp_scenario reached into @expcluster/roles/dist/node/* for the message
classes and the controller plugin type. The package index now re-exports
messages and the ControllerPlugin type, so consumers import from the
package name like they do with @clusterio/lib. The controller export is
type only, which keeps node code out of the web bundle. The test still
requires the controller classes from dist since they cannot be
re-exported at runtime.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 17:31:31 +00:00
bbassieandClaude Fable 5.1 3a9155697a Reference exp_roles and exp_groups from the exp_scenario build
exp_scenario imports types from @expcluster/roles and
@expcluster/permission-groups through their dist folders, so building it
on its own before those packages are built fails with TS2307. A plain
pnpm install runs the prepare scripts in dependency order, but a filtered
install or running tsc --build in exp_scenario on a fresh clone does not.
Referencing the node projects of both packages makes tsc build them first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 16:58:09 +00:00
BastiaanandClaude Fable 5.1 24efb82d0f Encode group permissions as a 1-based array (#472)
encode_group_permissions filled the whitelist and blacklist starting at
index 0. Factorio's table_to_json only serialises a table as a JSON array
when its keys run 1..n, so the permissions reached the instance plugin as
an object and every GroupUpdateRequest failed schema validation.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 15:47:01 +01:00
Bastiaan 0854a2b7d5 Move the seed into exp_scenario and seed the permission groups (#457)
The seed roles were owned by exp_roles, but they describe the scenario, so
they now live in exp_scenario/seed.ts next to the permissions they grant.
Each seed role names the permission group its holders belong to, and the
five groups the legacy config defined (Admin, Trusted, Standard, Guest,
Restricted) are seeded through exp_groups along with one role mapping per
role. Mapping priorities follow how exp_roles ranks a player's highest
role, so Jail lands in Restricted regardless of other roles.

SeedRolesRequest becomes exp_scenario's SeedRequest behind a new
exp_scenario.seed permission, and the button moves to the scenario's web
plugin, which gets a web entrypoint for it. exp_roles no longer depends on
exp_scenario, and exp_scenario gains controller tests around the seed.

With groups seeded from the controller the legacy expcore.permission_groups
module and its config are removed, along with the Group rcon static.
2026-09-08 11:20:44 +01:00
phidiasandWeblate f805a1e760 fix readme (#470)
* chore(l10n): update translation files

Add-on: Cleanup translation files
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.aperx.org/projects/expcluster/expscenario/
Translation: ExpCluster/ExpScenario

* fix readme

* layout

* chore(l10n): update English translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update Chinese (Traditional Han script) translation

chore(l10n): update Chinese (Simplified Han script) translation

chore(l10n): update English translation

Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: phidias <phidias@aperx.org>
Language: Chinese (Simplified Han script)
Language: Chinese (Traditional Han script)
Language: English
Progress: 100.0% (1 of 1 strings)
Progress: 100.0% (2 of 2 strings)
Progress: 100.0% (233 of 233 strings)
Progress: 100.0% (4 of 4 strings)
Translate-URL: https://translate.aperx.org/projects/expcluster/explegacy/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/explegacy/zh_Hant/
Translate-URL: https://translate.aperx.org/projects/expcluster/exprole/en/
Translate-URL: https://translate.aperx.org/projects/expcluster/exprole/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/exprole/zh_Hant/
Translate-URL: https://translate.aperx.org/projects/expcluster/expserverups/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/expserverups/zh_Hant/
Translate-URL: https://translate.aperx.org/projects/expcluster/exputil/zh_Hans/
Translate-URL: https://translate.aperx.org/projects/expcluster/exputil/zh_Hant/
Translation: ExpCluster/ExpLegacy
Translation: ExpCluster/ExpRole
Translation: ExpCluster/ExpServerUPS
Translation: ExpCluster/ExpUtil

* Revert "Translate"

* .

---------

Co-authored-by: Weblate <noreply@weblate.org>
2026-09-08 11:05:08 +01:00
phidias 142d296a02 Merge pull request #455 from PHIDIAS0303/patch-1
Localization
2026-09-06 17:05:04 +01:00
Cooldude2606 58c2ad6fb5 Merge pull request #465 from bbassie/fix/rocket-fired-log
Only log a rocket as fired when its ammo count drops
2026-09-06 01:55:34 +01:00
Cooldude2606 bad80ed77a Merge pull request #467 from bbassie/feat/surveillance-cursor
Show the cursor of the followed player in surveillance
2026-09-06 01:47:29 +01:00
bbassie 397033e8a6 Read ammo slots on join so the first shot is logged
Clearing the slots on leave meant nothing was known about a player's ammo
until it changed, so the first shot after rejoining was missed. The slots
are now read when a player joins and when they respawn, since a new
character starts empty and a stale single round would otherwise count as
a shot. The change handler reads the slots the same way and compares them
with what was stored.
2026-09-06 00:45:53 +00:00
Cooldude2606 1de50da0be Adjust button formatting 2026-09-06 01:44:40 +01:00
bbassie 4d976a9e35 Show the cursor as a slot in the surveillance header
The cursor was a line of text under the camera, which read as an
afterthought next to the framed header. It is now a slot button in the
header after the zoom buttons: the item sprite with its count, greyed out
for a ghost, an empty slot for an empty cursor, and the item name in the
tooltip. The window keeps its shape whatever the item is called.
2026-09-06 00:24:28 +00:00
Cooldude2606 e14e27c158 Merge pull request #466 from bbassie/fix/quickbar-pages
Use page and slot for quick bar filters
2026-09-06 01:08:32 +01:00
Cooldude2606 01bc4cd14d Added constant for total page count 2026-09-06 01:07:19 +01:00
Cooldude2606 09fe5d5f8d Merge pull request #464 from bbassie/fix/vehicle-kills
Count kills and damage dealt from vehicles
2026-09-06 00:42:54 +01:00
Cooldude2606 c4cd7d690d Merge pull request #461 from bbassie/feature/remove-warnings
Remove the warning system
2026-09-06 00:32:06 +01:00
Cooldude2606 98545f1828 Merge branch 'main' into feature/remove-warnings 2026-09-06 00:31:28 +01:00
Cooldude2606 42f177a58e Merge pull request #460 from bbassie/feature/scenario-spectate
Move spectate into exp_scenario
2026-09-06 00:27:52 +01:00
Cooldude2606 e1966dec9c Small format changes 2026-09-06 00:27:14 +01:00
Cooldude2606 bbf036b14b Merge pull request #459 from bbassie/feature/scenario-protection
Move protection into exp_scenario
2026-09-06 00:16:20 +01:00
Cooldude2606 702016b3e2 Remove redundant event properties 2026-09-06 00:15:37 +01:00
Cooldude2606 ac7cdbe01a Merge branch 'main' into feature/scenario-protection 2026-09-06 00:13:41 +01:00
Cooldude2606 d5c0c1005f Merge pull request #458 from bbassie/feature/scenario-jail
Move jail into exp_scenario
2026-09-06 00:04:09 +01:00
Cooldude2606 c12f0a8f89 Remove redundant event properties 2026-09-06 00:03:26 +01:00
bbassie 00253de11f Show the cursor of the followed player in surveillance
A label under the camera shows what the player being followed holds in
their cursor, item and count or the ghost item, so that using a
deconstruction planner or similar can be seen. It is hidden while the
camera shows a fixed location.

Closes #427
2026-09-05 20:54:57 +00:00
bbassie f961a8d82e Use page and slot for quick bar filters
Factorio 2.1 changed get_quick_bar_slot and set_quick_bar_slot to take a
page and slot rather than a single index, and to describe slots holding
records, remotes and specific item instances. Saved filters keep their
single index, which is converted on load and save, and only plain item
filters are saved since the other slot types hold data which has no name
to store. The command is enabled again.

Fixes #444
2026-09-05 20:54:21 +00:00
bbassie ce7a6ae1bf Only log a rocket as fired when its ammo count drops
Factorio has no fired event, so the log was written on every ammo
inventory change, which includes loading rockets for the first time and
swapping between rocket types. The last seen name and count of each ammo
slot is now kept per player, and a shot is only logged when a slot holds
the same ammo with one fewer, or empties from a single round. Only the
three configured ammo types are logged, rather than every ammo change.

Fixes #242
2026-09-05 20:53:57 +00:00
bbassie 37eff4b3e9 Count kills and damage dealt from vehicles
The statistics only credited damage and kills when the cause was a
character, so anything done from a car, tank, spidertron or locomotive was
lost. The cause is now resolved to a player through the vehicle's driver,
or passenger when there is no driver, and turrets, remotes and uncrewed
trains still count for nobody.

Fixes #219
2026-09-05 20:53:56 +00:00
bbassie a59b2a8414 Remove the warning system
Warnings were a moderator tool layered on top of reports and had no
callers left outside their own command and the player list button. The
legacy module, its config and locale, the exp_scenario command and its
permissions, the discord alert block and the player list button are all
removed. Reporting from the player list no longer depends on whether the
player could give warnings, anyone can report a player who is not immune.
2026-09-05 19:22:37 +00:00
bbassie 8014cb1e77 Move spectate into exp_scenario
The spectate and follow module moves to exp_scenario/module/control/spectate.lua
in the event_handler shape the other control modules use, and the copy in
exp_legacy is removed. Follow state is a typed record rather than a
positional table, the follow label caption is localised, and the escape
handler marks the record to stop on the next tick instead of poking an
invalid position into it.

The LuaPlayer.close_map call is gone: it does not exist in Factorio 2.0,
where the map is the remote controller and set_controller replaces it.
2026-09-05 19:20:55 +00:00
bbassie 0c52532c05 Move protection into exp_scenario
The entity protection module moves to exp_scenario/module/control/protection.lua
in the event_handler shape the other control modules use, and the copy in
exp_legacy is removed. The config lookups are built as local sets instead of
rewriting the config tables in place, the two mined handlers become one, and
the entity and area key helpers are exposed so the protection command no
longer keeps its own copies. Event ids are exposed as
Protection.on_player_mined_protected and Protection.on_repeat_violation.
2026-09-05 19:19:45 +00:00
bbassie 2e53e4668d Move jail into exp_scenario
With the role system finished the jail module has nothing legacy left in
it, so it moves to exp_scenario/module/control/jail.lua and the copy in
exp_legacy is removed. The module takes LuaPlayer only, requires a reason,
returns false rather than nil when there is nothing to do, and exposes its
event ids as Jail.on_player_jailed and Jail.on_player_unjailed in the same
shape as exp_util's selection events.
2026-09-05 19:18:04 +00:00
Cooldude2606 810269971b fix: bump to 7.0.1 2026-09-05 17:14:37 +01:00
Cooldude2606 0d0f08bcdc Merge pull request #454 from PHIDIAS0303/patch-1
GroupViewPage.tsx double static
2026-09-04 17:24:36 +01:00
phidias 72cd203c25 Update GroupViewPage.tsx 2026-09-05 00:57:13 +09:00
Cooldude2606 f8ccc87edc Merge pull request #453 from bbassie/feature/roles-migration
Move the scenario onto exp_roles and remove the legacy role system
2026-09-01 09:28:34 +01:00
bbassieandClaude Fable 5 08fe6b688e Type the test environments for autocomplete
Building on the class annotations from the smoke test changes:

- The suite is generic over its environment: Framework.suite is
  @generic T : Stubs with the extension returning T, and Suite<T> passes T to
  every test function. A test file declares
  `local Suite = ... --- @type Suite<ExpRoles.TestEnv>` and env autocompletes
  from there.
- The stubs declare their recorded fields, add_player returns Stubs.Player,
  and the server is one.
- ExpRoles.TestEnv : Stubs declares the extension fields, so env.R returns
  ExpRoles.Role and env.Roles is the module.

The typing immediately paid for itself by flagging real drift in the tests,
now fixed: _script_data is package private so the env exposes script_data()
instead, the join event carries its name and tick, the assignment record type
admits is_deleted, admin_state is a file local rather than an undeclared
field, and the event assertions which indexed [1] without a nil check compare
the whole event list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-01 06:09:40 +00:00
Cooldude2606 59df8bdff3 Manual changes following smoke test 2026-09-01 01:04:09 +01:00
bbassieandClaude Fable 5 574a0a4b52 Address final review nits on the assertions
- Suite.empty(value, name) checks a table has no entries and reports what it
  held, and Suite.throws(fn, message, name) asserts a function errors with the
  given message, so an unrelated error no longer passes as the expected one.
- Scalar comparisons and zero length checks go through eq and empty, and the
  announced messages and print output are compared by content, so a failure
  shows the actual data.
- get_roles() is asserted through sorted names rather than a count.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 10:48:43 +00:00
bbassieandClaude Fable 5 3218351db6 Address review on the suite and instance tests
- The instance tests run against a real Instance with a real InstanceConfig,
  matching the controller tests: the spies are sendTo and the server, which
  record what leaves the instance, so sendRcon passes through the real script
  command gate. The plugin's config fields are registered so the sync mode is
  a real field.
- Shallow eq is gone and eq compares recursively; the suite is created with
  Framework.suite(extend_env), which hands the extension a fresh set of stubs
  per test, so the plugin's env.lua is only the extension.
- add_player assigns continuous indexes itself.
- The lua fixtures are referenced by role name: assignments take names, and
  ids in expectations come from the role object. The name lookup in env.R
  uses a fixture index rather than searching the roles.
- Test names format functions as name() and methods as .name().
- Branch coverage filled in: sort tie breaking, the highest role assertion
  when a player has no roles, has all for the server, the by player default
  from game.player, deleted assignment records on initialise, set_emit_events
  with no argument, printing to a role with no holders, role property update
  validation, the assignment subscription replay, unassignment over the ipc,
  and a refused removal having nothing to roll back.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 21:11:58 +00:00
bbassieandClaude Fable 5 e6552a39be Address review on the stubs and controller tests
- The controller tests run against a real Controller, which is side effect
  free while not started, with real users through its UserManager. The only
  fakes left are two spies which record broadcasts and permission pushes on
  their way through. Since any user update also applies auto assignment, the
  leave event is observed directly rather than through a role change.
- raise_event fills in the name and tick of the event the way factorio does,
  rather than wrapping the payload, and game.players finds players by index
  as well as by name through a metatable.
- names is generic over anything with a name property, so it lives on the
  suite; the save and load helper no longer calls on_load, the test calls the
  handler itself as it does for the other handlers.
- Sent messages and events are compared whole with deep_eq, which pins the
  event shape, the tick, and that the unassign key is absent rather than
  empty.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 16:18:09 +00:00
bbassieandClaude Fable 5 7adcdde9dc Address review on the test framework
- The registry is a Suite, created around the environment factory it runs its
  tests with, so the plugin's env.lua reads as: build environments, hand the
  test files a suite of them. The suite returned there becomes `...` in each
  test file, which is now said where it happens.
- pass and fail are the primitives every other check goes through. eq and
  deep_eq assert rather than compare, failing with both values in the detail.
- Stubs are extended through extend_requires, extend_script, extend_game and
  extend_defines, a recursive merge which raises when a value already exists,
  rather than by mutating the tables. The strict labels carry the factorio
  class names.
- The stubs record registered metatables and can save and load the script
  data the way factorio does: functions are refused and only registered
  metatables survive. env.save_load() uses it, and a new on_load test shows
  role methods and held roles surviving the round trip, which only passes
  because the module registers its metatable.
- The names helper moved out of the shared framework, it is role specific.
- Tests are named after the function or method they cover, on both sides:
  the lua tests read as "role:assign applies locally and is sent", and the
  javascript files wrap their tests in the class they exercise with subtests
  per method. module.test.js is control.test.js, after the file it covers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-22 22:21:39 +00:00
bbassieandClaude Fable 5 24d36db601 Address review on the test harness
- The generic parts move to test/ in the repository root so other plugins can
  reuse them: the factorio and clusterio stubs, the test framework, the
  fengari runner, and clusterio's testMatrix and round trip helpers. A plugin
  composes them from its own env.lua, which adds its stubs and fixtures.
- Tests are declared with Test.test(name, fn) and every test function
  receives a fresh environment, so nothing carries over between them. A test
  which errors is reported as a failure rather than aborting the file.
- Every stub raises on properties it does not implement, which mirrors the
  game api. game.player is the one property allowed to read as nil.
- Test.deep_eq compares tables recursively with keys checked from both sides.
- The message records round trip through the same testMatrix and
  testRoundTripJsonSerialisable helpers the clusterio tests use, covering
  every optional field combination of the records, events and requests.
- controller.test.js and instance.test.js cover the node side of the plugin
  against faked controller and instance internals: property creation and
  sweeping, record building, broadcasts, subscription replay, assignment
  validation, auto assignment and its blocking role, seeding, the initialise
  payload, sync mode gating, and the rejection rollback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-22 16:45:51 +00:00
bbassieandClaude Fable 5 59a0e0be13 Build the effective roles in a single pass
The list restarts whenever a higher priority is found, rather than collecting
every role and filtering afterwards.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-22 16:45:51 +00:00
bbassieandClaude Fable 5 e79822b26e Add a test suite for the roles plugin
Run with `pnpm --filter @expcluster/roles test`, using tap as the runner.

The lua module is exercised for real: each test file runs in its own lua
state, created on first use by the helper, with the factorio surface and the
clusterio modules stubbed. The environment is passed to the chunk as an
argument so no globals are involved. Covers lookups and comparisons, the
permission checks, assignment with confirmation, rejection and local only
roles, jail suppression, the sync entry points, and the holder listings,
including a player holding a role in both the synced and the local list.

The javascript side covers the message records round tripping through their
schemas, the indexed permission encoding, and the seed: every permission it
grants must be defined by exp_scenario, and every parent must exist and have
its permissions carried into its children.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 22:02:51 +00:00
bbassieandClaude Fable 5 8a15745cf8 Address review on the role lookups
- player_has_any_permission and player_has_all_permission, matching the
  account checks the web ui has.
- Roles are no longer sorted on the way out of every lookup. get_ordered_roles
  and the public sort_roles cover the two guis and the command which present
  roles in order, and the highest role is found with a single scan.
- get_held_role_ids returns the list and the set it already built, rather than
  a second function rebuilding the set from the list.
- get_player_names collects into a set before listing, so a player holding the
  role in both the synced and the local list is counted once.
- The role metatable is registered directly under the plugin name, dropping
  the storage import.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 22:02:51 +00:00
bbassieandClaude Fable 5 bea8d46c82 Address review on the role api
- Roles are objects and everything done to or with a role is a method on it:
  assign, unassign, has_player, has_permission, is_higher_than,
  is_lower_than, get_players, get_player_names, print. Assignment has one
  entry point, role:assign(player, options), with local_only as an option
  rather than a second function.
- Roles are looked up by clusterio id with get_role; get_role_by_name searches
  the list for the few places, such as configs, which only know a name. The
  name map and the ordered list are gone, get_roles sorts on demand and the
  index field is replaced by the comparison methods.
- Players are LuaPlayer objects only, with nil or index 0 for the server.
- get_higher_roles and get_lower_roles replace print_to_roles_higher and
  print_to_roles_lower, call sites loop over them with role:print.
- Permission groups are removed from roles again, exp_groups owns the mapping
  from roles to groups.
- Seeding is a SeedRolesRequest behind a button on the roles page rather than
  running on first start, and creates only the roles; the player assignments
  are dropped. The seed lists each permission once at the lowest role which
  has it and lets the parent chain carry it up.
- System commands unlock for core.admin rather than a permission of their own.
- Role metatables are registered with Storage.register_metatable so the
  methods survive save and load, which the role records in storage needed.
- The player list auth uses Roles.player_outranks directly, and the event
  carries role ids rather than names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:52:50 +00:00
bbassieandClaude Fable 5 78a533a6f6 Split the seed into the role and assignment halves
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 11:39:51 +00:00