From 8f6d6e1caa6649867f5854f086eabf78e2a072f3 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Fri, 19 Jun 2026 20:05:48 +0000 Subject: [PATCH] Fix milestone lint warning in rocket info gui Narrow the milestone loop variable with a type check instead of an @cast, which tripped cast-type-mismatch because the milestones config mixes the show_milestones flag in with the numbers. Co-Authored-By: Claude Opus 4.8 (1M context) --- exp_scenario/module/gui/rocket_info.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/exp_scenario/module/gui/rocket_info.lua b/exp_scenario/module/gui/rocket_info.lua index c6be45a4..10774ae4 100644 --- a/exp_scenario/module/gui/rocket_info.lua +++ b/exp_scenario/module/gui/rocket_info.lua @@ -155,13 +155,15 @@ local function compute_milestone_rows(force) local rows = {} for _, milestone in ipairs(config.milestones) do - --- @cast milestone number - if milestone <= force_rockets then - local time = times[milestone] or 0 - rows[#rows + 1] = { milestone = milestone, value = time_formats.caption_hours(time), tooltip = time_formats.tooltip_hours(time) } - else - rows[#rows + 1] = { milestone = milestone, value = { "exp-gui_rocket-info.data-caption-milestone-next" }, tooltip = { "exp-gui_rocket-info.data-tooltip-milestone-next" } } - break + -- The milestones config mixes the show_milestones flag with the milestone numbers + if type(milestone) == "number" then + if milestone <= force_rockets then + local time = times[milestone] or 0 + rows[#rows + 1] = { milestone = milestone, value = time_formats.caption_hours(time), tooltip = time_formats.tooltip_hours(time) } + else + rows[#rows + 1] = { milestone = milestone, value = { "exp-gui_rocket-info.data-caption-milestone-next" }, tooltip = { "exp-gui_rocket-info.data-tooltip-milestone-next" } } + break + end end end