Commit Graph
23 Commits
Author SHA1 Message Date
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 7d8de94c2f Assert row lookups and the position shorthand
spawn_area accepts both position forms on purpose, so it asserts that
one of the two is present rather than narrowing the type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 b75e283fc0 Narrow the remaining position, box and colour reads
Color.struct leaves every channel optional, so the rainbow command
declares its own fully populated colour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 a4213dadf5 Narrow positions and bounding boxes at the boundary
Values read back from the game always use the named members, so they
are narrowed once where they enter a function rather than at each use.

`LuaControl.force` is a ForceID union, so reading a force only method
off it needs the cast the rest of the repo already uses.

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 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 d78ae40c5d Correct partial table types
`_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>
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 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
bbassieandClaude Opus 5 b9cfbc9036 Narrow aabb types and give generic aliases their type argument
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>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 90f32699c7 Fix duplicate class and annotation placement lint errors
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>
2026-08-07 15:31:18 +00:00
Cooldude2606andGitHub 27b1a34a83 Merge pull request #443 from Cooldude2606/fix/lint
Fixes many lint issues and other bugs
2026-06-26 15:58:47 +01:00
phidiasandGitHub 1f3689a0ac entity api change (#442)
* Update warps.lua

* .

* .
2026-06-26 15:45:46 +01:00
Cooldude2606 7be2f8d490 Fix lint errors 2026-06-26 15:02:08 +01:00
phidiasandGitHub 3a8d83f981 research changes (#430)
* Add event handlers for research reversed and queued

* Update roles.lua

* Remove bonus inventory settings from research.lua

Removed bonus inventory configuration for mining productivity.

* Update en.cfg

* Update zh-CN.cfg

* Update zh-TW.cfg

* Update research.lua

* Delete exp_scenario/module/commands/research.lua

* Update quick_actions.lua

* Update research.lua

* Update research.lua

* Update research.lua
2026-06-26 11:56:24 +01:00
8190b2165d mine depletion (#439)
* Update mine_depletion.lua

* Update miner.lua

* Update mine_depletion.lua

* Compatibility with 2.0 and 2.1

---------

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
2026-06-26 11:37:00 +01:00
dc015bc609 bonus changes (#429)
* Delete exp_legacy/module/modules/data/bonus.lua

* Update _file_loader.lua

* Update roles.lua

* Update bonus.lua

* Update player_bonus.lua

* Update bonus.lua

---------

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
2026-06-24 21:30:46 +01:00
1a561f9d1d extra_logging spaces and fix to player_died (#417)
* extra_logging spaces and fix to player_died

* Update extra_logging.lua

* Update extra_logging.lua

* Update extra_logging.lua

* Remove redundant checks

---------

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
2026-05-13 20:47:02 +01:00
6cbc4e5cfb fix inventory clear (#416)
* Update clear_items function to accept player name

* Update inventory_clear.lua

* Update exp_scenario/module/control/inventory_clear.lua

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>

---------

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
2026-03-27 13:48:53 +00:00
Cooldude2606andGitHub 9bd699ebf1 Refactor legacy addons into Clusterio format (#413)
* Refactor custom start

* Refactor afk kick

* Fix use of assert get player

* Refactor chat popup

* Refactor chat auto reply

* Refactor help bubbles

* Refactor damage popups

* Refactor death markers

* Refactor deconstruction log

* Remove FAGC logging

* Refactor discord alerts

* Refactor insert pickup

* Refactor inventory clear

* Refactor extra logging

* Refactor nuke protection

* Refactor pollution grading

* Refactor protection jail

* Refactor report jail

* Refactor mine depletion

* Refactor degrading tiles

* Refactor station auto name

* Refactor spawn area

* Refactor fast deconstruction

* Bug Fixes
2025-12-02 18:34:24 +00:00
Cooldude2606 360247d292 Fix surface bonus application 2025-09-21 19:45:42 +01:00
Cooldude2606andGitHub 7ab721b4b6 Refactor some of the Guis from the legacy plugin (#399)
* Fix bugs in core and add default args to Gui defs

* Refactor production Gui

* Refactor landfill blueprint button

* Fix more bugs in core

* Consistent naming of new guis

* Refactor module inserter gui

* Refactor surveillance gui

* Add shorthand for data from arguments

* Make element names consistent

* Add types

* Change how table rows work

* Refactor player stats gui

* Refactor quick actions gui

* Refactor research milestones gui

* Refactor player bonus gui

* Refactor science production gui

* Refactor autofill gui

* Cleanup use of aligned flow

* Rename "Gui.element" to "Gui.define"

* Rename Gui types

* Rename property_from_arg

* Add guide for making guis

* Add full reference document

* Add condensed reference

* Apply style guide to refactored guis

* Bug fixes
2025-08-29 14:30:30 +01:00