Only refresh open tab and exclude virtual signals from provided/requested on stations tab

This commit is contained in:
Will Berry
2023-03-10 10:19:30 -05:00
parent 118f8c9eb2
commit 9343d06620
5 changed files with 43 additions and 11 deletions

View File

@@ -13,9 +13,7 @@ function inventory_tab.create()
type = "tab",
caption = { "cybersyn-gui.inventory" },
ref = { "inventory", "tab" },
actions = {
on_click = { gui = "main", action = "change_tab", tab = "inventory" },
},
handler = inventory_tab.handle.on_inventory_tab_selected
},
content = {
name = "manager_inventory_content_frame",
@@ -243,4 +241,22 @@ function inventory_tab.build(map_data, player_data)
end
inventory_tab.handle = {}
--- @param e {player_index: uint}
function inventory_tab.wrapper(e, handler)
local player = game.get_player(e.player_index)
if not player then return end
local player_data = global.manager.players[e.player_index]
handler(player, player_data, player_data.refs, e)
end
---@param player LuaPlayer
---@param player_data PlayerData
function inventory_tab.handle.on_inventory_tab_selected(player, player_data)
player_data.selected_tab = "inventory_tab"
end
gui.add_handlers(inventory_tab.handle, inventory_tab.wrapper)
return inventory_tab