181 Commits
Author SHA1 Message Date
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
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
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
phidias 142d296a02 Merge pull request #455 from PHIDIAS0303/patch-1
Localization
2026-09-06 17:05:04 +01: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 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 ac7cdbe01a Merge branch 'main' into feature/scenario-protection 2026-09-06 00:13:41 +01: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 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
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 7034f17b5d Move the scenario onto exp_roles and remove the legacy role system
Every call site of expcore.roles now uses exp_roles, and the legacy module,
its config, and the glue which refreshed guis on role events are deleted.
Where a file only renamed the require and the permission strings the change is
mechanical; the rest:

- Jail is now "give the Jail role" and unjail "take it away". The role has a
  higher priority than every other so holding it suppresses them, which is
  what stashing and restoring the roles was for.
- The command role authority derives exp_scenario.command.<name> from the
  command name, and the role parsers use player_outranks rather than comparing
  indexes with their own root check.
- The admin and spectator triggers, and the gui refresh on role changes, live
  in exp_scenario/control/roles.lua; the system commands trigger stays with
  the command authority.
- The player list warn button is keyed on create_warning, the permission
  the command behind it already required, and report on create_report. Both
  were keyed on names no role held, so only root ever saw them.
- The warps and tasks configs say exp_roles where they said expcore.roles.
- The role tables the readme and player list read are replaced by
  get_player_names and get_roles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 11:36:58 +00:00
Cooldude2606 5890155331 Final manual fixups 2026-08-08 23:09:39 +01:00
Cooldude2606 1e861c5c0b Fix issue with MapPosition.energy 2026-08-08 21:58:46 +01:00
bbassieandClaude Opus 5 619ed4b39f Remove asserts the types already cover
The nil check burn down added guards which turned out redundant once
the surrounding annotations landed. `_has_handlers` is set to true when
the first handler registers, so it is a boolean rather than the literal
false it was inferred as.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:48 +00:00
bbassieandClaude Opus 5 f907007d14 Fix arity and return value mismatches
`assert` returns every argument it is given, so `return assert(x, msg)`
was leaking the message as a second return value.

`get_tile` is documented as taking x and y. The async function class
declared `@operator call` with no parameters, which made every async
call look over supplied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:48 +00:00
bbassieandClaude Opus 5 f5656025ee Clear the last of the nil checks
Guards now cover the statements that follow them, and a couple of reads
are restructured so the narrowing survives.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 76ecc37d3f Type the legacy role registry
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 b5bbf73332 Patch MapPosition and BoundingBox to the named form
The api documents both as a union with a positional array because both
are accepted as input, which makes every read of `.x` or `.left_top`
optional. Everything read back from the game uses the named form, so
the positional variant is removed and we now always write it that way
too.

The spawn area config offsets and the mine depletion search areas were
the only positional writes left, and apply_offset no longer needs its
fallback.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 f9ce3c4145 Assert row lookups and narrow force and style reads
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 0b31a70801 Type forward declared handlers and assert element parents
The player list action setter runs during control setup, before any of
the callbacks that use it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 aca8bc79ae Assert the vlayer gui lookups
Dropdowns are siblings of the button that reads them, and the loop
bounds come from the interface count.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 d44381bac1 Assert the vlayer gui lookups
Dropdowns are siblings of the button that reads them, and the loop
bounds come from the interface count.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 d25fc42538 Assert vlayer runtime invariants and type its storage
The interfaces are chests and constant combinators, so the inventory,
logistic sections and first circuit section always exist.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 7bb874f73f Describe the legacy role type
get_player_roles always returns at least the default or root role, so
get_player_highest_role never returns nil, and callers were right to
treat it that way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 3f46055b70 Enable need-check-nil and start the burn down
`Roles.new_role` returned the result of `error`, which made it nullable,
and `set_permission_group` returned nil for an unknown group, which
broke the config chain with an index error rather than saying so.

Positions and bounding boxes read back from the game always use the
named members, so they are narrowed once where they enter a function.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 f39da0c585 Type the last of the forward declarations
Locals declared ahead of an assignment inside a callback were inferred
as nil at every use site.

The role event handlers are given a class so the table is not unified
with the other module handler tables.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 5aeafa0e11 Fix child lookups, cache keys and loadstring
`loadstring` was removed in Lua 5.2, `load` takes a string the same way.

Warp gui child lookups are optional, so they use the same assert the
rest of the repo does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 b07052307d Fix stale vlayer signals and index types
`LogisticFilter.signal` became `value` in 2.0, so the clear loop broke
on the first slot and outdated signals were left behind.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 4745b6de0b Give the role methods an explicit self
emmylua takes self from the owner table, so `@param self ExpRoles.Role`
only applies with dot syntax. Call sites still use a colon.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 589b876865 Fix a nil config read and two key types
`config.temp_warning_limit` does not exist, the warnings config defines
`script_warning_limit`, and the locale expects it as `__3__/__4__`, so
the command was printing nil.

map_tags is keyed by the force name joined to the tag number, and
custom_color is the Color union.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 164672602d Make the @as casts actually apply
emmylua only parses the inline cast as `--[[@as T]]`, the spaced form
`--[[ @as T ]]` is treated as a plain comment, so all 149 of them were
doing nothing.

LuaGuiElement.style is a union because a style name can be assigned to
it, so reading it back needs the cast.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 8ae1144585 Fix logistic network stats for the 2.0 api
`get_contents` and `targeted_items_pickup`/`_deliver` return lists of
ItemWithQualityCount in 2.0, they are no longer name keyed dictionaries,
so the logistorage stats were indexing by array position.

PreferenceEnum is bidirectional, matching what ExpUtil.enum returns.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 ecf236d831 Describe the Datastore type
The registry and the prototype were both bare tables, so every
`datastore:method()` call resolved to nothing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 ab89b9feca Type vlayer forward declarations and config entries
The gui element locals are declared at the top and assigned far below,
so emmylua inferred them as nil at every use site.

circuit_oc was reassigned from a control behaviour to a logistic
section, which hid every section method behind the wrong type.

allowed_items entries carry heterogeneous optional properties, now
described by a class.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 c233a9ab06 Defer need-check-nil and clean up stale suppressions
emmylua deserialises an unknown diagnostic code to a catch all that
matches no checker, so every `invisible`, `nil-check` and
`global-element` suppression was silently doing nothing. Renamed to the
emmylua codes. `name-style-check` has no equivalent and is dropped, it
was already disabled under luals.

The `get_tile` suppressions referenced an api typedef bug from 2024
which no longer reproduces.

need-check-nil is deferred rather than disabled on merit: a third of the
407 findings come from MapPosition and BoundingBox being aliased as
`struct|[double, double]`, so every `entity.position.x` reads as
possibly nil. The rest need per site knowledge of runtime invariants.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
phidias 4255522c57 Research Log (#447)
* Update research.lua

* Fix config file references in research milestones
2026-08-04 14:35:26 +01:00
Cooldude2606 a07be7b7ed Bump version in package jsons 2026-07-14 00:50:00 +01:00
Cooldude2606 27b1a34a83 Merge pull request #443 from Cooldude2606/fix/lint
Fixes many lint issues and other bugs
2026-06-26 15:58:47 +01:00
phidias 1f3689a0ac entity api change (#442)
* Update warps.lua

* .

* .
2026-06-26 15:45:46 +01:00
Cooldude2606 8b3c437847 Move debug GUI out of legacy 2026-06-26 15:22:06 +01:00
Cooldude2606 95bb8ac304 Move logo out of legacy 2026-06-26 15:09:11 +01:00
Cooldude2606 7be2f8d490 Fix lint errors 2026-06-26 15:02:08 +01:00