Commit Graph
3045 Commits
Author SHA1 Message Date
phidias 94ac391fc4 Merge branch 'explosivegaming:main' into aperx 2026-09-19 02:44:20 +09:00
Cooldude2606 06fc1086e3 Merge pull request #476 from bbassie/feature/esm-migration
Migrate to ES modules
2026-09-12 01:18:22 +01:00
bbassieandClaude Fable 5.1 7fd66c6ac7 Migrate to ES modules
Clusterio #984 converted its packages to ESM, so a CommonJS plugin can
no longer import @clusterio/lib and plugin entrypoints must name the
full file. Every package gets "type": "module", entrypoints and relative
imports carry the .js extension, and the webpack configs become .cjs as
webpack-cli loads them with require. tsconfig.node.json moves from
node16 to nodenext to match clusterio, which needs it for the JSON
import attributes in its sources.

The tap tests and the shared test helpers use import and
import.meta.dirname. The test scripts pass --type-strip-only so tap
leaves lib's .ts subpath imports to Node's own type stripping, as its
TypeScript loader compiled them without a default export. The lua
runner resolves fengari from the test file it is given, since a bare
import from the shared test directory does not reach the plugin's
devDependencies.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-12 01:10:02 +01:00
Cooldude2606 797d7501c7 Merge pull request #475 from bbassie/feature/plugin-permissions
Declare permissions on the plugin declaration
2026-09-12 01:09:26 +01:00
bbassieandClaude Fable 5.1 30f1b5ea75 Declare permissions on the plugin declaration
Clusterio #988 added a permissions array to PluginDeclaration and a
type level Permissions registry, and made checkPermission and the web
UI hasPermission helpers take PermissionName. Move the definePermission
calls of exp_groups and exp_scenario into the declaration and add the
names to the registry so the web pages type check. The browser
tsconfigs include index.ts so the augmentation is visible to the web
bundle, matching the in-repo plugins.

The exp_scenario table keeps its tuple form and derives the name union
from it, so a new row is still one line. Seed role permissions are typed
as PermissionName, so a typo in seed.ts is now a compile error rather
than a warning at seed time. The tests register the declared
permissions through registerPluginPermissions instead of importing
permissions.ts for its side effect.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 23:27:17 +00:00
Cooldude2606 24d2f76a35 Merge pull request #474 from bbassie/feature/node-ci
Add a Node.js CI workflow that builds and tests inside clusterio
2026-09-11 23:43:13 +01:00
Cooldude2606 2048de6244 Small changes to node ci 2026-09-11 23:41:04 +01:00
phidias 01845fead7 a (#44)
* .

* .

* .

* .

* compilatron

* .

* .

* .

* .

* links

* .

* .

* .

* Update tsconfig.browser.json
2026-09-10 17:04:06 +09:00
bbassieandClaude Fable 5.1 5487976a21 Add a Node.js CI workflow that builds and tests inside clusterio
The packages use workspace:^ and catalog: versions, so they only
resolve inside a clusterio checkout with this repository under
external_plugins. The workflow clones clusterio master, checks this
repository out into external_plugins/ExpCluster, runs pnpm install
(which runs every prepare script), then runs the tap suites.

A last step wipes dist and runs tsc --build in each package on its own.
pnpm install builds packages in dependency order, which is why the
missing project references fixed in #473 went unnoticed. On the tree
before #473 this step fails with the same five TS2307 errors.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 17:56:01 +00: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