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>
This commit is contained in:
bbassie
2026-08-07 15:31:18 +00:00
co-authored by Claude Opus 5
parent c6da1fd9ac
commit 90f32699c7
18 changed files with 29 additions and 30 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ local valid, invalid = Commands.status.success, Commands.status.invalid_input
local Roles = require("modules.exp_legacy.expcore.roles")
local highest_role = Roles.get_player_highest_role
local types = {} --- @class Commands.types
local types = {} --- @class (partial) Commands.types
--- A role defined by exp roles
types.role = add("role", Commands.types.key_of(Roles.config.roles))
+4 -1
View File
@@ -11,7 +11,10 @@ local player_has_flag = Roles.player_has_flag
local Reports = require("modules.exp_legacy.modules.control.reports") --- @dep modules.control.reports
--- @type Commands.InputParser
--- @param input string
--- @param player LuaPlayer
--- @return Commands.Status
--- @return LuaPlayer | LocalisedString
local function reportable_player(input, player)
local success, status, result = parse_input(input, player, Commands.types.player)
if not success then return status, result end
+6 -2
View File
@@ -10,7 +10,10 @@ local format_player_name = Commands.format_player_name_locale
local format_number = require("util").format_number
--- A player who is of a lower role than the executing player
--- @type Commands.InputParser
--- @param input string
--- @param player LuaPlayer
--- @return Commands.Status
--- @return LuaItemPrototype | LocalisedString
local function parse_item(input, player)
-- First Case - internal name is given
-- Second Case - rich text is given
@@ -146,7 +149,8 @@ Commands.new("search-online", { "exp-commands_search.description-online" })
end)
--- Return the amount of an item a player has
--- @type SortFunction
--- @param data SearchResult
--- @return number
local function sort_by_count(data)
return data.count
end
+1 -1
View File
@@ -10,7 +10,7 @@ local format_number = require("util").format_number
local commands = {}
--- Set all trains to automatic
--- @class ExpCommand_Artillery.commands.artillery: ExpCommand
--- @class ExpCommand_Trains.commands.set_trains_to_automatic: ExpCommand
--- @overload fun(player: LuaPlayer, surface: LuaSurface?, force: LuaForce?)
commands.set_trains_to_automatic = Commands.new("set-trains-to-automatic", { "exp-commands_trains.description" })
:optional("surface", { "exp-commands_trains.arg-surface" }, Commands.types.surface)