`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>
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>
Autofill stores the whole per entity map against a player.
The readme container is called as a define, so it needs the overload
the other element classes carry.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`_display_data` is a cache keyed by force name, not a single record.
The auto complete accumulator starts empty, so its fields are optional.
Game commands have no usage beyond their own help text.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The top, left and relative element tables are keyed by the define, but
the duplicate registration assert looked up `define.name`, so it never
fired.
GuiIter.remove_element indexed `registered_scopes` by player index
instead of the scope elements it had just fetched, so it removed
nothing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`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>
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>
`data` on an element is the GuiData store keyed by element, not the
value being stored.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`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>
The prune loop shadowed its own parameter, so `silo_data[unit_number] =
nil` wrote into the entry instead of removing it from the table.
`unit_number` is optional on LuaEntity but always set for a silo. Note
that `--[[ @as ]]` does not narrow for an index expression, only
`@cast` does.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
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>
Async ids come from `get_function_name`, which returns a string, but
were documented as numbers.
`setmetatable` in clusterio's compat module loses `LibCompat` on the
module return, so the require is cast.
`GuiData.__index` accepts a `DataKey` but emmylua needs that as an
index signature on the class.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
The aabb functions all index the named members, so passing the
shorthand [MapPosition, MapPosition] form would error at runtime. The
annotations now say so.
emmylua requires a type argument on a generic alias, luals did not.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Classes contributed to by more than one file now carry the `partial`
attribute. trains.lua declared its command as `ExpCommand_Artillery`,
which was a copy paste.
`Color.0` and `MapPosition.0` became `.struct` in fmtk 2.1.6.
emmylua rejects `@type` on a function statement or a `do` block, so
those are moved onto the local or replaced by `@param` and `@return`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
fmtk 2.1.4 onwards generates typedefs targeting emmylua that luals
misreads, and every fmtk changelog since 2.1.5 states luals support is
being dropped. luals 3.18.2 is already the latest release, so there is
nothing to bump.
The `--clusterio-modules` plugin has no emmylua equivalent, as emmylua
has no plugin interface, so it is reimplemented as `workspace.moduleMap`.
Those rules rewrite each file's own module path rather than the require
string, hence the reversed direction.
type.patch.lua is obsolete: `raise_event` now takes `LuaEventType` in
the generated typedefs, and `LuaObject` has become `LuaObject.base`.
exp_scenario/.luacheckrc was already dead, luacheck is never invoked.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FMTK 2.1.4 onwards reshapes its generated typedefs for EmmyLua, which
LuaLS misreads: 2.1.4 changed dicts to table<K,V> (game.surfaces.nauvis
now reports undefined-field) and 2.1.5 changed LocalisedString to the
variadic tuple [string, LocalisedString...], which LuaLS 3.18.2 cannot
match against a plain string. Together those account for all 279
findings CI has reported since 2026-07-13; with 2.1.3 the check is
clean.
Upstream FMTK has announced it is dropping sumneko/LuaLS support in
favour of EmmyLua, so this pin is a stopgap until the check is ported
to emmylua_check.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
- 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>
Checked with the same LuaLS version and factorio library CI uses. The module now
reports no findings; the 279 which remain are all pre-existing and main is
already failing on them.
Most were annotations rather than behaviour. Two are worth noting:
- The role prototype is now its own class which the role inherits, since
defining methods on a table annotated as the role counted as injecting fields
into it.
- The role change message is built from a literal locale key per branch. Building
the key by concatenation gives a plain string where a localised string is
wanted, which is the same finding the legacy module reports.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Clusterio already stores roles, the permissions they grant, and which user holds
which role, along with a web UI for all three. What it does not have is the
properties a role only needs in game, or a way for an instance to learn about
any of it, since role and user updates are only sent to control connections.
This plugin fills both gaps. The controller keeps a record per role holding the
order, priority, short hand, tag, colour and auto assign threshold, created
automatically for any role which does not have one. It then rebroadcasts roles
and assignments on its own events so instances can follow them.
The lua module presents the same interface the legacy expcore.roles module did,
so the call sites can be moved over without being rewritten. Permission checks
translate the legacy action strings using the same mapping exp_scenario defines.
Two things replace features the legacy system had:
- Priority replaces disallow. Only the roles with the highest priority a player
holds are considered, so Jail can suppress every other role including the
default one, without needing to take roles away first.
- Assignments made in game are applied locally and then sent to the controller,
which keeps assign_player synchronous for callers. A role which should never
leave this map, such as one earned from time on the map, is assigned with
assign_player_local instead.
Roles earned from online time across the cluster are granted by the controller
from the threshold on the role, using the online time clusterio already tracks.
Nothing requires this plugin yet; moving the call sites off expcore.roles and
removing the legacy config is left for a follow up.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The role system is moving onto clusterio's own roles and permissions, which
requires every in game action to exist as a real permission rather than a bare
string held only by the lua config.
Adds a permission for each of the 104 actions and 7 flags used by the legacy
role config. Names are derived from the legacy action by a deterministic
transform, exported so the lua side can apply the same mapping and keep existing
call sites working. Command descriptions are taken from the existing locale
entries so they match what players already see.
Actions held by the Guest role are marked grantByDefault, since the in game
default role and clusterio's default role are the same concept.
Role management actions have no scenario permission; they map onto
core.user.update_roles and core.role.list instead.
Also corrects the /unjail description, which was a copy of /jail.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Migrate player list gui to scenario
Move modules/gui/player-list into exp_scenario/gui/player_list using the
new exp_gui element API, matching the other scenario guis.
- Store the selected player and action on the container's player data
instead of a datastore, folding the datastore on_update reactivity
into explicit setter functions
- Switch the actions config to injected accessor functions and the
exp-gui_player-list locale namespace
- Add the locale section, register in control.lua, and disable the
legacy module in the file loader
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Align names and call patterns to best practice
Apply the conventions from the rocket info gui review to the player list,
and remove the now migrated legacy module.
- Move row building onto the table def as calculate_row_data, and refresh
via refresh_player which computes the row data once per player
- Store the selection on the container with private/public accessor
methods instead of poking element data directly
- Store the selected player as a LuaPlayer rather than a string and update
the actions config to match
- Use :style{} on the player table and make the action and reason bars
their own element definitions
- Delete the migrated legacy gui and its file loader entry
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Address player list review feedback
- Rename the player table element data class to element_data
- Remove the redundant offline selection clear; on_player_left_game
already clears any selection pointing at a player who disconnects
- Move the action bar and reason bar visibility into their own refresh
methods so refresh_player just delegates to them
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Style and locale fixes
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>