mirror of
https://github.com/minetest/minetest.git
synced 2024-12-25 07:32:24 +01:00
Fix single click world select
This commit is contained in:
parent
85f3d575ec
commit
29b0dc89e6
@ -307,7 +307,7 @@ function menu_worldmt(selected, setting, value)
|
|||||||
local filename = world.path .. DIR_DELIM .. "world.mt"
|
local filename = world.path .. DIR_DELIM .. "world.mt"
|
||||||
local world_conf = Settings(filename)
|
local world_conf = Settings(filename)
|
||||||
|
|
||||||
if value then
|
if value ~= nil then
|
||||||
if not world_conf:write() then
|
if not world_conf:write() then
|
||||||
core.log("error", "Failed to write world config file")
|
core.log("error", "Failed to write world config file")
|
||||||
end
|
end
|
||||||
@ -320,14 +320,14 @@ function menu_worldmt(selected, setting, value)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function menu_worldmt_legacy()
|
function menu_worldmt_legacy(selected)
|
||||||
local modes = {"creative_mode", "enable_damage"}
|
local modes_names = {"creative_mode", "enable_damage"}
|
||||||
for _, mode in pairs(modes) do
|
for _, mode_name in pairs(modes_names) do
|
||||||
local mode = menu_worldmt(selected, ""..mode.."")
|
local mode_val = menu_worldmt(selected, mode_name)
|
||||||
if mode then
|
if mode_val ~= nil then
|
||||||
core.setting_set(""..mode.."", mode)
|
core.setting_set(mode_name, mode_val)
|
||||||
else
|
else
|
||||||
menu_worldmt(selected, ""..mode.."", core.setting_get(""..mode..""))
|
menu_worldmt(selected, mode_name, core.setting_get(mode_name))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -69,7 +69,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
local event = core.explode_textlist_event(fields["srv_worlds"])
|
local event = core.explode_textlist_event(fields["srv_worlds"])
|
||||||
local selected = core.get_textlist_index("srv_worlds")
|
local selected = core.get_textlist_index("srv_worlds")
|
||||||
|
|
||||||
menu_worldmt_legacy()
|
menu_worldmt_legacy(selected)
|
||||||
|
|
||||||
if event.type == "DCL" then
|
if event.type == "DCL" then
|
||||||
world_doubleclick = true
|
world_doubleclick = true
|
||||||
|
@ -107,7 +107,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
local event = core.explode_textlist_event(fields["sp_worlds"])
|
local event = core.explode_textlist_event(fields["sp_worlds"])
|
||||||
local selected = core.get_textlist_index("sp_worlds")
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
|
|
||||||
menu_worldmt_legacy()
|
menu_worldmt_legacy(selected)
|
||||||
|
|
||||||
if event.type == "DCL" then
|
if event.type == "DCL" then
|
||||||
world_doubleclick = true
|
world_doubleclick = true
|
||||||
|
Loading…
Reference in New Issue
Block a user