mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
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>
This commit is contained in:
@@ -85,7 +85,7 @@ function Toolbar.set_button_toggled_state(define, player, state, _from_left)
|
||||
button.style = state and toolbar_button_active_style or toolbar_button_default_style
|
||||
|
||||
-- Make the extra required adjustments
|
||||
local style = button.style
|
||||
local style = button.style --[[@as LuaStyle]]
|
||||
style.minimal_width = original_width
|
||||
style.maximal_height = original_height
|
||||
if button.type == "sprite-button" then
|
||||
|
||||
@@ -55,7 +55,7 @@ Elements.open_action_bar = Gui.define("player_list/open_action_bar")
|
||||
--- @param highlighted boolean
|
||||
function Elements.open_action_bar.set_highlight(open_button, highlighted)
|
||||
open_button.style = highlighted and "tool_button" or "frame_button"
|
||||
local style = open_button.style
|
||||
local style = open_button.style --[[@as LuaStyle]]
|
||||
style.padding = -2
|
||||
style.width = 8
|
||||
style.height = 14
|
||||
|
||||
@@ -261,7 +261,8 @@ define_tab(
|
||||
|
||||
local rules = Gui.elements.scroll_table(container, scroll_height, 1)
|
||||
rules.style = "bordered_table"
|
||||
rules.style.cell_padding = 4
|
||||
local rules_style = rules.style --[[@as LuaStyle]]
|
||||
rules_style.cell_padding = 4
|
||||
|
||||
for i = 1, 15 do
|
||||
Gui.elements.centered_label(rules, frame_width - 30, { "exp-gui_readme.rules-" .. i })
|
||||
@@ -287,7 +288,8 @@ define_tab(
|
||||
|
||||
local commands = Gui.elements.scroll_table(container, scroll_height, 2)
|
||||
commands.style = "bordered_table"
|
||||
commands.style.cell_padding = 0
|
||||
local commands_style = commands.style --[[@as LuaStyle]]
|
||||
commands_style.cell_padding = 0
|
||||
|
||||
for name, command in pairs(Commands.list_for_player(player)) do
|
||||
Gui.elements.centered_label(commands, 120, name)
|
||||
|
||||
@@ -312,7 +312,8 @@ function Elements.science_table.refresh_row(science_table, row_data)
|
||||
-- Update the icon
|
||||
local icon = row.icon
|
||||
icon.style = row_data.icon_style
|
||||
icon.style.height = 55
|
||||
local icon_style = icon.style --[[@as LuaStyle]]
|
||||
icon_style.height = 55
|
||||
|
||||
-- Update the element visibility
|
||||
row.net_suffix.visible = true
|
||||
|
||||
Reference in New Issue
Block a user