1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-01 13:08:05 +02:00

fix for panel destroying elements

This commit is contained in:
MewMew 2020-01-08 19:50:52 +01:00
parent 4863ca8270
commit d196375035

View File

@ -23,7 +23,13 @@ end
function Public.comfy_panel_clear_left_gui(player) function Public.comfy_panel_clear_left_gui(player)
for _, child in pairs(player.gui.left.children) do for _, child in pairs(player.gui.left.children) do
child.destroy() child.visible = false
end
end
function Public.comfy_panel_restore_left_gui(player)
for _, child in pairs(player.gui.left.children) do
child.visible = true
end end
end end
@ -115,6 +121,7 @@ local function on_gui_click(event)
if event.element.name == "comfy_panel_top_button" then if event.element.name == "comfy_panel_top_button" then
if player.gui.left.comfy_panel then if player.gui.left.comfy_panel then
player.gui.left.comfy_panel.destroy() player.gui.left.comfy_panel.destroy()
Public.comfy_panel_restore_left_gui(player)
return return
else else
main_frame(player) main_frame(player)
@ -124,6 +131,7 @@ local function on_gui_click(event)
if event.element.caption == "X" and event.element.name == "comfy_panel_close" then if event.element.caption == "X" and event.element.name == "comfy_panel_close" then
player.gui.left.comfy_panel.destroy() player.gui.left.comfy_panel.destroy()
Public.comfy_panel_restore_left_gui(player)
return return
end end