mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
Fix child lookups, cache keys and loadstring
`loadstring` was removed in Lua 5.2, `load` takes a string the same way. Warp gui child lookups are optional, so they use the same assert the rest of the repo does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -894,7 +894,7 @@ role:set_permission_group('Admin')
|
|||||||
function Roles._prototype:set_permission_group(name, use_factorio_api)
|
function Roles._prototype:set_permission_group(name, use_factorio_api)
|
||||||
ExpUtil.assert_not_runtime()
|
ExpUtil.assert_not_runtime()
|
||||||
if use_factorio_api then
|
if use_factorio_api then
|
||||||
self.permission_group = { true, name }
|
self.permission_group = { true, name } --[[@as [boolean, string] ]]
|
||||||
else
|
else
|
||||||
local group = Groups.get_group_by_name(name)
|
local group = Groups.get_group_by_name(name)
|
||||||
if not group then return end
|
if not group then return end
|
||||||
|
|||||||
@@ -291,9 +291,13 @@ local confirm_edit_button = Gui.define("confirm_edit_button")
|
|||||||
}
|
}
|
||||||
:style(Styles.sprite22)
|
:style(Styles.sprite22)
|
||||||
:on_click(function(def, player, element)
|
:on_click(function(def, player, element)
|
||||||
local warp_id = element.parent.caption
|
local parent = assert(element.parent)
|
||||||
local warp_name = element.parent.parent["name-" .. warp_id][warp_textfield.name].text
|
local grandparent = assert(parent.parent)
|
||||||
local warp_icon = element.parent.parent["icon-" .. warp_id][warp_icon_editing.name].elem_value --[[@as SignalID]]
|
local warp_id = parent.caption --[[@as string]]
|
||||||
|
local name_flow = assert(grandparent["name-" .. warp_id])
|
||||||
|
local icon_flow = assert(grandparent["icon-" .. warp_id])
|
||||||
|
local warp_name = assert(name_flow[warp_textfield.name]).text
|
||||||
|
local warp_icon = assert(icon_flow[warp_icon_editing.name]).elem_value --[[@as SignalID]]
|
||||||
if warp_icon.type == nil then warp_icon.type = "item" end
|
if warp_icon.type == nil then warp_icon.type = "item" end
|
||||||
Warps.set_editing(warp_id, player.name)
|
Warps.set_editing(warp_id, player.name)
|
||||||
Warps.update_warp(warp_id, warp_name, warp_icon, player.name)
|
Warps.update_warp(warp_id, warp_name, warp_icon, player.name)
|
||||||
@@ -778,7 +782,7 @@ Event.on_nth_tick(math.floor(60 / config.update_smoothing), function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check if the force has any warps
|
-- Check if the force has any warps
|
||||||
local closest_warp = nil
|
local closest_warp = nil --- @type { warp_id: string, name: string }?
|
||||||
local closest_distance = nil
|
local closest_distance = nil
|
||||||
if #warp_ids > 0 then
|
if #warp_ids > 0 then
|
||||||
local surface = player.surface
|
local surface = player.surface
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ local ExpUtil = require("modules/exp_util")
|
|||||||
local concat = table.concat
|
local concat = table.concat
|
||||||
local inspect = table.inspect
|
local inspect = table.inspect
|
||||||
local pcall = pcall
|
local pcall = pcall
|
||||||
local loadstring = loadstring --- @diagnostic disable-line
|
local loadstring = load
|
||||||
local rawset = rawset
|
local rawset = rawset
|
||||||
|
|
||||||
local Public = {}
|
local Public = {}
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ function Elements.science_table.refresh_row(science_table, row_data)
|
|||||||
Elements.production_label.refresh(row.used, row_data.used)
|
Elements.production_label.refresh(row.used, row_data.used)
|
||||||
end
|
end
|
||||||
|
|
||||||
do local _row_data = {} --- @type table<string, { [string]: ExpGui_ScienceProduction.elements.science_table.row_data }>
|
do local _row_data = {} --- @type table<string, table<number, ExpGui_ScienceProduction.elements.science_table.row_data>>
|
||||||
--- Refresh the production tables for all online players
|
--- Refresh the production tables for all online players
|
||||||
function Elements.science_table.refresh_online()
|
function Elements.science_table.refresh_online()
|
||||||
-- Refresh the row data for online forces
|
-- Refresh the row data for online forces
|
||||||
|
|||||||
Reference in New Issue
Block a user