From f4693ecb413bcc615acea7e4c09e7af0507e7512 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Mon, 16 Nov 2026 21:13:35 +0900 Subject: [PATCH] s --- exp_scenario/module/gui/vlayer.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/exp_scenario/module/gui/vlayer.lua b/exp_scenario/module/gui/vlayer.lua index 94749e7f..08ed7309 100644 --- a/exp_scenario/module/gui/vlayer.lua +++ b/exp_scenario/module/gui/vlayer.lua @@ -255,7 +255,9 @@ local function surface_index_from_element(controls) local elements = Elements.controls.data[controls] local element = elements.surface_dropdown local surface = 0 - if element then + if element and game.surfaces[element.selected_index] then + surface = element.selected_index + --[[ local surface_name = element.items[element.selected_index] if surface_name then ---@diagnostic disable-next-line: undefined-field @@ -264,6 +266,7 @@ local function surface_index_from_element(controls) surface = s.index end end + ]] end return surface end @@ -303,10 +306,11 @@ Elements.surface_dropdown = Gui.define("vlayer/surface_dropdown") --- @param surfaces LuaSurface[] function Elements.surface_dropdown.refresh(surface_dropdown, surfaces) local items = {} - local index = 1 + -- local index = 1 for _, surface in pairs(surfaces) do - items[index] = surface.name - index = index + 1 + items[surface.index] = surface.name + -- items[index] = surface.name + -- index = index + 1 end surface_dropdown.items = items end