From d78ae40c5d6849e87079ce8929a9fa24b871bce4 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Thu, 6 Aug 2026 21:45:36 +0000 Subject: [PATCH] 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) --- exp_commands/module/search.lua | 3 ++- exp_scenario/module/control/fast_deconstruction.lua | 3 ++- exp_scenario/module/gui/module_inserter.lua | 4 ++-- exp_scenario/module/gui/research_milestones.lua | 1 + exp_scenario/module/gui/science_production.lua | 2 +- exp_util/module/module_exports.lua | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/exp_commands/module/search.lua b/exp_commands/module/search.lua index 56fe8b05..d2e3fef9 100644 --- a/exp_commands/module/search.lua +++ b/exp_commands/module/search.lua @@ -49,7 +49,8 @@ function Search.prepare(custom_commands) command_objects[name] = { name = name, description = locale_desc, - help_text = locale_desc, + help_text = locale_desc, + usage = locale_desc, aliases = {}, } end diff --git a/exp_scenario/module/control/fast_deconstruction.lua b/exp_scenario/module/control/fast_deconstruction.lua index 85a825f9..acd83069 100644 --- a/exp_scenario/module/control/fast_deconstruction.lua +++ b/exp_scenario/module/control/fast_deconstruction.lua @@ -77,7 +77,8 @@ local function get_player_cache(player_index) -- Create a new cache if the previous on is in use if not cache or cache.task and not cache.task.completed then - cache = {} --[[@as any]] + --- @diagnostic disable-next-line: missing-fields + cache = {} --[[@as TreeDeconCache]] end local player = assert(game.get_player(player_index)) diff --git a/exp_scenario/module/gui/module_inserter.lua b/exp_scenario/module/gui/module_inserter.lua index 68a72023..a263932f 100644 --- a/exp_scenario/module/gui/module_inserter.lua +++ b/exp_scenario/module/gui/module_inserter.lua @@ -277,8 +277,8 @@ local function apply_planners_in_area(player, area, machine_name, planner_with_p -- Bounding box table to be reused in the loop below --- @type BoundingBox local param_area = { - left_top = {}, - right_bottom = {} + left_top = { x = 0, y = 0 }, + right_bottom = { x = 0, y = 0 }, } -- Update area param table to be reused in the loop below diff --git a/exp_scenario/module/gui/research_milestones.lua b/exp_scenario/module/gui/research_milestones.lua index 2e886f32..3863af68 100644 --- a/exp_scenario/module/gui/research_milestones.lua +++ b/exp_scenario/module/gui/research_milestones.lua @@ -128,6 +128,7 @@ Elements.milestone_table = Gui.define("research_milestones/milestone_table") do local _row_data = {} --- @type ExpGui_ResearchMilestones.elements.milestone_table.row_data + --- @diagnostic disable-next-line: missing-fields local empty_row_data = { color = font_color.positive } --- Get the row data for a force and research diff --git a/exp_scenario/module/gui/science_production.lua b/exp_scenario/module/gui/science_production.lua index 7d3a829c..c654d924 100644 --- a/exp_scenario/module/gui/science_production.lua +++ b/exp_scenario/module/gui/science_production.lua @@ -416,7 +416,7 @@ function Elements.eta_label.refresh(eta_label) eta_label.tooltip = display_data.tooltip end -do local _display_data = {} --- @type Elements.eta_label.display_data +do local _display_data = {} --- @type table --- Refresh the eta label for all online players function Elements.eta_label.refresh_online() -- Refresh the row data for online forces diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index e6394bae..5bddd019 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -207,7 +207,7 @@ end function ExpUtil.auto_complete(options, input, use_key, rtn_key, use_pattern) input = input:lower() local plain = use_pattern ~= true - local found = {} --- @type { length: number, index: number, start: boolean, value: any } + local found = {} --- @type { length: number?, index: number?, start: boolean?, value: any } for k, v in pairs(options) do local str = use_key and k or v local index = str:lower():find(input, nil, plain)