mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-19 23:23:12 +09:00
s
This commit is contained in:
1 parent
8beade92c1
commit
f4693ecb41
1 file changed
+8
-4
@@ -255,7 +255,9 @@ local function surface_index_from_element(controls)
|
|||||||
local elements = Elements.controls.data[controls]
|
local elements = Elements.controls.data[controls]
|
||||||
local element = elements.surface_dropdown
|
local element = elements.surface_dropdown
|
||||||
local surface = 0
|
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]
|
local surface_name = element.items[element.selected_index]
|
||||||
if surface_name then
|
if surface_name then
|
||||||
---@diagnostic disable-next-line: undefined-field
|
---@diagnostic disable-next-line: undefined-field
|
||||||
@@ -264,6 +266,7 @@ local function surface_index_from_element(controls)
|
|||||||
surface = s.index
|
surface = s.index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
return surface
|
return surface
|
||||||
end
|
end
|
||||||
@@ -303,10 +306,11 @@ Elements.surface_dropdown = Gui.define("vlayer/surface_dropdown")
|
|||||||
--- @param surfaces LuaSurface[]
|
--- @param surfaces LuaSurface[]
|
||||||
function Elements.surface_dropdown.refresh(surface_dropdown, surfaces)
|
function Elements.surface_dropdown.refresh(surface_dropdown, surfaces)
|
||||||
local items = {}
|
local items = {}
|
||||||
local index = 1
|
-- local index = 1
|
||||||
for _, surface in pairs(surfaces) do
|
for _, surface in pairs(surfaces) do
|
||||||
items[index] = surface.name
|
items[surface.index] = surface.name
|
||||||
index = index + 1
|
-- items[index] = surface.name
|
||||||
|
-- index = index + 1
|
||||||
end
|
end
|
||||||
surface_dropdown.items = items
|
surface_dropdown.items = items
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user