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:
@@ -31,7 +31,7 @@ end
|
||||
|
||||
-- gets the action player and a coloured name for the action to be used on
|
||||
local function get_action_player(player)
|
||||
local selected_player = get_selected_player(player) --[[ @as LuaPlayer ]]
|
||||
local selected_player = get_selected_player(player) --[[@as LuaPlayer]]
|
||||
local selected_player_color = format_player_name(selected_player)
|
||||
return selected_player, selected_player_color
|
||||
end
|
||||
|
||||
@@ -142,7 +142,7 @@ group:set_action('toggle_map_editor', false)
|
||||
|
||||
]]
|
||||
function PermissionsGroups._prototype:set_action(action, state)
|
||||
local input_action = defines.input_action[action] --[[ @as defines.input_action? ]]
|
||||
local input_action = defines.input_action[action] --[[@as defines.input_action?]]
|
||||
if input_action == nil then input_action = action end
|
||||
assert(type(input_action) == "number", tostring(action) .. " is not a valid input action")
|
||||
self.actions[input_action] = state
|
||||
|
||||
@@ -18,7 +18,7 @@ ToolbarState:on_load(function(player_name, value)
|
||||
|
||||
local decompressed = helpers.json_to_table(assert(helpers.decode_string(value), "Failed String Decode"))
|
||||
local player = assert(game.get_player(player_name))
|
||||
Gui.toolbar.set_state(player, decompressed --[[ @as Gui.ToolbarState ]])
|
||||
Gui.toolbar.set_state(player, decompressed --[[@as Gui.ToolbarState]])
|
||||
|
||||
return nil -- We don't save the state, use Gui.toolbar.get_state
|
||||
end)
|
||||
|
||||
@@ -273,7 +273,7 @@ local warp_textfield = Gui.define("warp_textfield")
|
||||
:on_confirmed(function(def, player, element)
|
||||
local warp_id = element.parent.caption
|
||||
local warp_name = element.text
|
||||
local warp_icon = element.parent.parent["icon-" .. warp_id][warp_icon_editing.name].elem_value --[[ @as SignalID ]]
|
||||
local warp_icon = element.parent.parent["icon-" .. warp_id][warp_icon_editing.name].elem_value --[[@as SignalID]]
|
||||
if warp_icon.type == nil then warp_icon.type = "item" end
|
||||
Warps.set_editing(warp_id, player.name)
|
||||
Warps.update_warp(warp_id, warp_name, warp_icon, player.name)
|
||||
@@ -293,7 +293,7 @@ local confirm_edit_button = Gui.define("confirm_edit_button")
|
||||
:on_click(function(def, player, element)
|
||||
local warp_id = element.parent.caption
|
||||
local warp_name = element.parent.parent["name-" .. warp_id][warp_textfield.name].text
|
||||
local warp_icon = element.parent.parent["icon-" .. warp_id][warp_icon_editing.name].elem_value --[[ @as SignalID ]]
|
||||
local warp_icon = element.parent.parent["icon-" .. warp_id][warp_icon_editing.name].elem_value --[[@as SignalID]]
|
||||
if warp_icon.type == nil then warp_icon.type = "item" end
|
||||
Warps.set_editing(warp_id, player.name)
|
||||
Warps.update_warp(warp_id, warp_name, warp_icon, player.name)
|
||||
|
||||
Reference in New Issue
Block a user