1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-30 04:30:58 +02:00

Merge pull request #1139 from grilledham/loader_gui_layout

Fix loader gui layout issue in multiplayer
This commit is contained in:
grilledham 2021-01-01 15:50:30 +00:00 committed by GitHub
commit 34223ffdd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -328,15 +328,18 @@ end
local function draw_loader_frame_for_player(parent, player)
local frame = parent[loader_crafter_frame_for_player_name]
if frame and frame.valid then
Gui.destroy(frame)
end
local recipes = player.force.recipes
if not any_loader_enabled(recipes) then
if frame and frame.valid then
Gui.destroy(frame)
end
return
end
if frame and frame.valid then
Gui.clear(frame)
else
local anchor = {gui = defines.relative_gui_type.controller_gui, position = defines.relative_gui_position.right}
frame = parent.add {
type = 'frame',
@ -344,6 +347,7 @@ local function draw_loader_frame_for_player(parent, player)
anchor = anchor,
direction = 'vertical'
}
end
if recipes['loader'].enabled then
local button = frame.add {
@ -378,15 +382,18 @@ end
local function draw_loader_frame_for_assembly_machine(parent, entity, player)
local frame = parent[loader_crafter_frame_for_assembly_machine_name]
if frame and frame.valid then
Gui.destroy(frame)
end
local recipes = player.force.recipes
if not any_loader_enabled(recipes) then
if frame and frame.valid then
Gui.destroy(frame)
end
return
end
if frame and frame.valid then
Gui.clear(frame)
else
local anchor = {
gui = defines.relative_gui_type.assembling_machine_select_recipe_gui,
position = defines.relative_gui_position.right
@ -397,6 +404,7 @@ local function draw_loader_frame_for_assembly_machine(parent, entity, player)
anchor = anchor,
direction = 'vertical'
}
end
if recipes['loader'].enabled then
local button = frame.add {
@ -532,12 +540,7 @@ if config.loaders then
local relative = player.gui.relative
local panel = relative[loader_crafter_frame_for_assembly_machine_name]
if panel and panel.valid then
Gui.destroy(panel)
end
panel = relative[loader_crafter_frame_for_player_name]
if panel and panel.valid then
Gui.destroy(panel)
Gui.remove_data_recursively(panel)
end
end)
end