mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Fix world buttons not appearing (#16480)
This commit is contained in:
parent
d932f34693
commit
29490cb0f7
1 changed files with 8 additions and 8 deletions
|
@ -165,15 +165,15 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
|
|
||||||
local retval = ""
|
local retval = ""
|
||||||
|
|
||||||
local index = filterlist.get_current_index(menudata.worldlist,
|
local index = core.get_textlist_index("sp_worlds") or filterlist.get_current_index(menudata.worldlist,
|
||||||
tonumber(core.settings:get("mainmenu_last_selected_world")))
|
tonumber(core.settings:get("mainmenu_last_selected_world"))) or 0
|
||||||
|
|
||||||
local list = menudata.worldlist:get_list()
|
local list = menudata.worldlist:get_list()
|
||||||
local world = list and index and list[index]
|
-- When changing tabs to a world list with fewer entries, the last index is selected (visually).
|
||||||
|
-- However, the formspec fields lag behind, thus 'index > #list' can be a valid choice.
|
||||||
|
local world = list and list[math.min(index, #list)]
|
||||||
local game
|
local game
|
||||||
|
|
||||||
local is_world_selected = list and list[core.get_textlist_index("sp_worlds") or index]
|
|
||||||
|
|
||||||
if world then
|
if world then
|
||||||
game = pkgmgr.find_by_gameid(world.gameid)
|
game = pkgmgr.find_by_gameid(world.gameid)
|
||||||
else
|
else
|
||||||
|
@ -187,7 +187,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
local y = 0.2
|
local y = 0.2
|
||||||
local yo = 0.5625
|
local yo = 0.5625
|
||||||
|
|
||||||
if is_world_selected then
|
if world then
|
||||||
if disabled_settings["creative_mode"] == nil then
|
if disabled_settings["creative_mode"] == nil then
|
||||||
creative = "checkbox[0,"..y..";cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
creative = "checkbox[0,"..y..";cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
|
||||||
dump(core.settings:get_bool("creative_mode")) .. "]"
|
dump(core.settings:get_bool("creative_mode")) .. "]"
|
||||||
|
@ -208,7 +208,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"container[5.25,4.875]" ..
|
"container[5.25,4.875]" ..
|
||||||
"button[6.65,0;3.225,0.8;world_create;".. fgettext("New") .. "]"
|
"button[6.65,0;3.225,0.8;world_create;".. fgettext("New") .. "]"
|
||||||
if is_world_selected then
|
if world then
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"button[0,0;3.225,0.8;world_delete;".. fgettext("Delete") .. "]" ..
|
"button[0,0;3.225,0.8;world_delete;".. fgettext("Delete") .. "]" ..
|
||||||
"button[3.325,0;3.225,0.8;world_configure;".. fgettext("Select Mods") .. "]"
|
"button[3.325,0;3.225,0.8;world_configure;".. fgettext("Select Mods") .. "]"
|
||||||
|
@ -261,7 +261,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||||
end
|
end
|
||||||
|
|
||||||
retval = retval .. "container_end[]"
|
retval = retval .. "container_end[]"
|
||||||
elseif is_world_selected then
|
elseif world then
|
||||||
retval = retval ..
|
retval = retval ..
|
||||||
"button[10.1875,5.925;4.9375,0.8;play;" .. fgettext("Play Game") .. "]"
|
"button[10.1875,5.925;4.9375,0.8;play;" .. fgettext("Play Game") .. "]"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue