aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu/common.lua
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-01-09 21:15:35 +0100
committerGitHub <noreply@github.com>2022-01-09 21:15:35 +0100
commit4c8c6497799c83cb5bac773ac4eac7ea572ec78f (patch)
treeffa67ce9002a94f6354eedbc94a1b768ed0cd336 /builtin/mainmenu/common.lua
parentb164e16d1be30220029729d63a1e621395ad00ad (diff)
downloadminetest-4c8c6497799c83cb5bac773ac4eac7ea572ec78f.tar.gz
minetest-4c8c6497799c83cb5bac773ac4eac7ea572ec78f.tar.bz2
minetest-4c8c6497799c83cb5bac773ac4eac7ea572ec78f.zip
Mainmenu game-related changes (#11887)
fixes: * Switching between games does not immediately hide creative mode / damage buttons if so specified * World creation menu has a game selection list even though the menu already provides a gamebar * Showing gameid in world list is unnecessary * Choice of mapgen parameters in menu persists between games (and was half-broken)
Diffstat (limited to 'builtin/mainmenu/common.lua')
-rw-r--r--builtin/mainmenu/common.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index b36c9596a..8db8bb8d1 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -125,17 +125,21 @@ os.tmpname = function()
end
--------------------------------------------------------------------------------
-function menu_render_worldlist()
- local retval = ""
+function menu_render_worldlist(show_gameid)
+ local retval = {}
local current_worldlist = menudata.worldlist:get_list()
+ local row
for i, v in ipairs(current_worldlist) do
- if retval ~= "" then retval = retval .. "," end
- retval = retval .. core.formspec_escape(v.name) ..
- " \\[" .. core.formspec_escape(v.gameid) .. "\\]"
+ row = v.name
+ if show_gameid == nil or show_gameid == true then
+ row = row .. " [" .. v.gameid .. "]"
+ end
+ retval[#retval+1] = core.formspec_escape(row)
+
end
- return retval
+ return table.concat(retval, ",")
end
function menu_handle_key_up_down(fields, textlist, settingname)