mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
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:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -39,7 +39,7 @@ local function get_player_name(event)
|
||||
end
|
||||
|
||||
--- Convert a colour value into hex
|
||||
--- @param color Color.0
|
||||
--- @param color Color.struct
|
||||
--- @return string
|
||||
local function to_hex(color)
|
||||
local hex_digits = "0123456789ABCDEF"
|
||||
@@ -53,7 +53,7 @@ local function to_hex(color)
|
||||
end
|
||||
|
||||
--- Emit the requires json to file for the given event arguments
|
||||
--- @param opts { title: string?, color: (Color.0 | string)?, description: string?, tick: number?, fields: { name: string, value: string, inline: boolean? }[] }
|
||||
--- @param opts { title: string?, color: (Color.struct | string)?, description: string?, tick: number?, fields: { name: string, value: string, inline: boolean? }[] }
|
||||
local function emit_event(opts)
|
||||
local admins_online = 0
|
||||
local players_online = 0
|
||||
|
||||
@@ -7,7 +7,7 @@ local config = require("modules.exp_legacy.config.spawn_area")
|
||||
--- Apply an offset to a LuaPosition
|
||||
--- @param position MapPosition
|
||||
--- @param offset MapPosition
|
||||
--- @return MapPosition.0
|
||||
--- @return MapPosition.struct
|
||||
local function apply_offset(position, offset)
|
||||
return {
|
||||
x = (position.x or position[1]) + (offset.x or offset[1]),
|
||||
|
||||
@@ -25,8 +25,7 @@ Elements.online_player_dropdown = Gui.define("player_dropdown")
|
||||
} --[[ @as any ]]
|
||||
|
||||
--- To help with caching and avoid context changes the player list from the previous update is remembered
|
||||
--- @type (string?)[]
|
||||
do local _player_names = {}
|
||||
do local _player_names = {} --- @type (string?)[]
|
||||
--- Updates the player name list after a join or leave
|
||||
--- @return (string?)[]
|
||||
function Elements.online_player_dropdown._update_player_names()
|
||||
|
||||
@@ -47,8 +47,7 @@ Elements.bonus_used = Gui.define("player_bonus/bonus_used")
|
||||
:element_data(0) --[[ @as any ]]
|
||||
|
||||
--- Value is cached to save perf
|
||||
--- @type table<number, number>
|
||||
do local _points_limit = {}
|
||||
do local _points_limit = {} --- @type table<number, number>
|
||||
--- Clear the cache for points limit
|
||||
--- @param player LuaPlayer
|
||||
function Elements.bonus_used._clear_points_limit_cache(player)
|
||||
|
||||
@@ -326,8 +326,7 @@ function Elements.science_table.refresh_row(science_table, row_data)
|
||||
Elements.production_label.refresh(row.used, row_data.used)
|
||||
end
|
||||
|
||||
--- @type table<string, { [string]: ExpGui_ScienceProduction.elements.science_table.row_data }>
|
||||
do local _row_data = {}
|
||||
do local _row_data = {} --- @type table<string, { [string]: ExpGui_ScienceProduction.elements.science_table.row_data }>
|
||||
--- Refresh the production tables for all online players
|
||||
function Elements.science_table.refresh_online()
|
||||
-- Refresh the row data for online forces
|
||||
@@ -416,8 +415,7 @@ function Elements.eta_label.refresh(eta_label)
|
||||
eta_label.tooltip = display_data.tooltip
|
||||
end
|
||||
|
||||
--- @type Elements.eta_label.display_data
|
||||
do local _display_data = {}
|
||||
do local _display_data = {} --- @type Elements.eta_label.display_data
|
||||
--- Refresh the eta label for all online players
|
||||
function Elements.eta_label.refresh_online()
|
||||
-- Refresh the row data for online forces
|
||||
@@ -477,8 +475,7 @@ local _fp_one_hour = defines.flow_precision_index.one_hour
|
||||
--- @field ten_minutes ExpGui_ScienceProduction._item_data
|
||||
--- @field one_hour ExpGui_ScienceProduction._item_data
|
||||
|
||||
--- @type table<string, { [string]: ExpGui_ScienceProduction.item_production_data }>
|
||||
do local _production_data = {}
|
||||
do local _production_data = {} --- @type table<string, { [string]: ExpGui_ScienceProduction.item_production_data }>
|
||||
|
||||
--- Get the production stats for a force
|
||||
--- @param flow_stats any
|
||||
|
||||
Reference in New Issue
Block a user