From 5e018c4f5fa58a3c38f2d9aedb3e05deb6beeb04 Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Sat, 7 Jun 2025 13:41:55 -0500 Subject: [PATCH 01/12] Add mapgen descriptions --- builtin/mainmenu/dlg_create_world.lua | 10 ++++++++-- src/mapgen/mapgen.cpp | 25 +++++++++++++++++-------- src/mapgen/mapgen.h | 1 + src/script/lua_api/l_mainmenu.cpp | 17 +++++++++++++++++ src/script/lua_api/l_mainmenu.h | 2 ++ 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 27fe68050..dc5b9bb8f 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -82,6 +82,7 @@ local function create_world_formspec(dialogdata) local current_mg = dialogdata.mg local mapgens = core.get_mapgen_names() + local mapgens_descriptions = core.get_mapgen_descriptions() local flags = dialogdata.flags @@ -109,6 +110,7 @@ local function create_world_formspec(dialogdata) if #allowed_mapgens > 0 then for i = #mapgens, 1, -1 do if table.indexof(allowed_mapgens, mapgens[i]) == -1 then + table.remove(mapgens_descriptions, i) table.remove(mapgens, i) end end @@ -117,6 +119,7 @@ local function create_world_formspec(dialogdata) if #disallowed_mapgens > 0 then for i = #mapgens, 1, -1 do if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then + table.remove(mapgens_descriptions, i) table.remove(mapgens, i) end end @@ -129,6 +132,7 @@ local function create_world_formspec(dialogdata) end local mglist = "" + local mgdescription = "" local selindex do -- build the list of mapgens local i = 1 @@ -138,6 +142,7 @@ local function create_world_formspec(dialogdata) first_mg = v end if current_mg == v then + mgdescription = mapgens_descriptions[k] selindex = i end i = i + 1 @@ -287,12 +292,13 @@ local function create_world_formspec(dialogdata) retval = retval .. "label[0,2;" .. fgettext("Mapgen") .. "]".. - "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" + "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]".. + "textarea[0.5,3.2;6,2;;;" .. core.formspec_escape(fgettext(mgdescription)) .. "]" -- Warning when making a devtest world if game.id == "devtest" then retval = retval .. - "container[0,3.5]" .. + "container[0,4.7]" .. "box[0,0;5.8,1.7;#ff8800]" .. "textarea[0.4,0.1;6,1.8;;;".. fgettext("Development Test is meant for developers.") .. "]" .. diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index e8c60c0de..955d0894c 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -62,6 +62,7 @@ const FlagDesc flagdesc_gennotify[] = { struct MapgenDesc { const char *name; bool is_user_visible; + const char *description; }; //// @@ -75,14 +76,14 @@ struct MapgenDesc { // Of the remaining, v5 last due to age, v7 first due to being the default. // The order of 'enum MapgenType' in mapgen.h must match this order. static MapgenDesc g_reg_mapgens[] = { - {"v7", true}, - {"valleys", true}, - {"carpathian", true}, - {"v5", true}, - {"flat", true}, - {"fractal", true}, - {"singlenode", true}, - {"v6", true}, + {"v7", true, "Default mapgen with large complex mountins and plains."}, + {"valleys", true, "Large valleys with complex terrain and rivers."}, + {"carpathian", true, "Realistic looking world with vast plains."}, + {"v5", true, "Old mapgen."}, + {"flat", true, "World Flat terrain."}, + {"fractal", true, "Wold with fractal structure."}, + {"singlenode", true, "Empty world, use for lua defined mapgens."}, + {"v6", true, "Simple mapgen with few features, not recommended."}, }; static_assert( @@ -207,6 +208,14 @@ void Mapgen::getMapgenNames(std::vector *mgnames, bool include_hid } } +void Mapgen::getMapgenDescriptions(std::vector *mgdescriptions, bool include_hidden) +{ + for (u32 i = 0; i != ARRLEN(g_reg_mapgens); i++) { + if (include_hidden || g_reg_mapgens[i].is_user_visible) + mgdescriptions->push_back(g_reg_mapgens[i].description); + } +} + void Mapgen::setDefaultSettings(Settings *settings) { settings->setDefault("mg_flags", flagdesc_mapgen, diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h index 31313b35f..170ee4abc 100644 --- a/src/mapgen/mapgen.h +++ b/src/mapgen/mapgen.h @@ -243,6 +243,7 @@ public: EmergeParams *emerge); static MapgenParams *createMapgenParams(MapgenType mgtype); static void getMapgenNames(std::vector *mgnames, bool include_hidden); + static void getMapgenDescriptions(std::vector *mgdescriptions, bool include_hidden); static void setDefaultSettings(Settings *settings); private: diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 4b878ee1c..3f76ff55d 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -660,6 +660,22 @@ int ModApiMainMenu::l_get_mapgen_names(lua_State *L) return 1; } +/******************************************************************************/ +int ModApiMainMenu::l_get_mapgen_descriptions(lua_State *L) +{ + std::vector descriptions; + bool include_hidden = lua_isboolean(L, 1) && readParam(L, 1); + Mapgen::getMapgenDescriptions(&descriptions, include_hidden); + + lua_newtable(L); + for (size_t i = 0; i != descriptions.size(); i++) { + lua_pushstring(L, descriptions[i]); + lua_rawseti(L, -2, i + 1); + } + + return 1; +} + /******************************************************************************/ int ModApiMainMenu::l_get_user_path(lua_State *L) @@ -1059,6 +1075,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(set_background); API_FCT(set_topleft_text); API_FCT(get_mapgen_names); + API_FCT(get_mapgen_descriptions); API_FCT(get_user_path); API_FCT(get_modpath); API_FCT(get_modpaths); diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index fc2d90af8..6bfed8826 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -51,6 +51,8 @@ private: static int l_get_mapgen_names(lua_State *L); + static int l_get_mapgen_descriptions(lua_State *L); + static int l_get_language(lua_State *L); //packages From 90873d62cbda70386937cb54793762d295f5a732 Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Sat, 7 Jun 2025 15:28:15 -0500 Subject: [PATCH 02/12] Add for async and documentation --- doc/menu_lua_api.md | 2 ++ src/script/lua_api/l_mainmenu.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/doc/menu_lua_api.md b/doc/menu_lua_api.md index 56b51f3b9..2fc2ee6da 100644 --- a/doc/menu_lua_api.md +++ b/doc/menu_lua_api.md @@ -109,6 +109,8 @@ of manually putting one, as different OSs use different delimiters. E.g. * `handle:stop()` or `core.sound_stop(handle)` * `core.get_mapgen_names([include_hidden=false])` -> table of map generator algorithms registered in the core (possible in async calls) +* `core.get_mapgen_descriptions([include_hidden=false])` -> table of map generator descriptions, + in the same order as returned by `core.get_mapgen_names` registered in the core (possible in async calls) * `core.get_cache_path()` -> path of cache * `core.get_temp_path([param])` (possible in async calls) * `param`=true: returns path to a newly created temporary file diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 3f76ff55d..e91d5eeed 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -1117,6 +1117,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top) API_FCT(get_worlds); API_FCT(get_games); API_FCT(get_mapgen_names); + API_FCT(get_mapgen_descriptions); API_FCT(get_user_path); API_FCT(get_modpath); API_FCT(get_modpaths); From 7f1dc29d7dfdb4d0d6a863af776a5ff2544fa8ba Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Tue, 17 Jun 2025 14:57:22 -0500 Subject: [PATCH 03/12] move to lua --- builtin/mainmenu/dlg_create_world.lua | 25 +++++++++++++++++-------- doc/menu_lua_api.md | 2 -- src/mapgen/mapgen.cpp | 24 ++++++++---------------- src/mapgen/mapgen.h | 1 - src/script/lua_api/l_mainmenu.cpp | 19 ------------------- src/script/lua_api/l_mainmenu.h | 2 -- 6 files changed, 25 insertions(+), 48 deletions(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index dc5b9bb8f..2a040db87 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -78,11 +78,21 @@ local mgv6_biomes = { }, } +local mapgens_descriptions = { + v7 = fgettext("Default mapgen with large complex mountins and plains."), + valleys = fgettext("Large valleys with complex terrain and rivers."), + carpathian = fgettext("Realistic looking world with vast plains."), + v5 = fgettext("Old mapgen."), + flat = fgettext("World Flat terrain."), + fractal = fgettext("Wold with fractal structure."), + singlenode = fgettext("Empty world, use for lua defined mapgens."), + v6 = fgettext("Simple mapgen with few features, not recommended."), +} + local function create_world_formspec(dialogdata) local current_mg = dialogdata.mg local mapgens = core.get_mapgen_names() - local mapgens_descriptions = core.get_mapgen_descriptions() local flags = dialogdata.flags @@ -110,7 +120,6 @@ local function create_world_formspec(dialogdata) if #allowed_mapgens > 0 then for i = #mapgens, 1, -1 do if table.indexof(allowed_mapgens, mapgens[i]) == -1 then - table.remove(mapgens_descriptions, i) table.remove(mapgens, i) end end @@ -119,7 +128,6 @@ local function create_world_formspec(dialogdata) if #disallowed_mapgens > 0 then for i = #mapgens, 1, -1 do if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then - table.remove(mapgens_descriptions, i) table.remove(mapgens, i) end end @@ -142,7 +150,6 @@ local function create_world_formspec(dialogdata) first_mg = v end if current_mg == v then - mgdescription = mapgens_descriptions[k] selindex = i end i = i + 1 @@ -290,10 +297,12 @@ local function create_world_formspec(dialogdata) end - retval = retval .. - "label[0,2;" .. fgettext("Mapgen") .. "]".. - "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]".. - "textarea[0.5,3.2;6,2;;;" .. core.formspec_escape(fgettext(mgdescription)) .. "]" + if mapgens_descriptions[current_mg] then + retval = retval .. + "label[0,2;" .. fgettext("Mapgen") .. "]".. + "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]".. + "textarea[0.5,3.2;6,2;;;" .. mapgens_descriptions[current_mg] .. "]" + end -- Warning when making a devtest world if game.id == "devtest" then diff --git a/doc/menu_lua_api.md b/doc/menu_lua_api.md index 2fc2ee6da..56b51f3b9 100644 --- a/doc/menu_lua_api.md +++ b/doc/menu_lua_api.md @@ -109,8 +109,6 @@ of manually putting one, as different OSs use different delimiters. E.g. * `handle:stop()` or `core.sound_stop(handle)` * `core.get_mapgen_names([include_hidden=false])` -> table of map generator algorithms registered in the core (possible in async calls) -* `core.get_mapgen_descriptions([include_hidden=false])` -> table of map generator descriptions, - in the same order as returned by `core.get_mapgen_names` registered in the core (possible in async calls) * `core.get_cache_path()` -> path of cache * `core.get_temp_path([param])` (possible in async calls) * `param`=true: returns path to a newly created temporary file diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 955d0894c..e9db85eb3 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -76,14 +76,14 @@ struct MapgenDesc { // Of the remaining, v5 last due to age, v7 first due to being the default. // The order of 'enum MapgenType' in mapgen.h must match this order. static MapgenDesc g_reg_mapgens[] = { - {"v7", true, "Default mapgen with large complex mountins and plains."}, - {"valleys", true, "Large valleys with complex terrain and rivers."}, - {"carpathian", true, "Realistic looking world with vast plains."}, - {"v5", true, "Old mapgen."}, - {"flat", true, "World Flat terrain."}, - {"fractal", true, "Wold with fractal structure."}, - {"singlenode", true, "Empty world, use for lua defined mapgens."}, - {"v6", true, "Simple mapgen with few features, not recommended."}, + {"v7", true}, + {"valleys", true}, + {"carpathian", true}, + {"v5", true}, + {"flat", true}, + {"fractal", true}, + {"singlenode", true}, + {"v6", true}, }; static_assert( @@ -208,14 +208,6 @@ void Mapgen::getMapgenNames(std::vector *mgnames, bool include_hid } } -void Mapgen::getMapgenDescriptions(std::vector *mgdescriptions, bool include_hidden) -{ - for (u32 i = 0; i != ARRLEN(g_reg_mapgens); i++) { - if (include_hidden || g_reg_mapgens[i].is_user_visible) - mgdescriptions->push_back(g_reg_mapgens[i].description); - } -} - void Mapgen::setDefaultSettings(Settings *settings) { settings->setDefault("mg_flags", flagdesc_mapgen, diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h index 170ee4abc..31313b35f 100644 --- a/src/mapgen/mapgen.h +++ b/src/mapgen/mapgen.h @@ -243,7 +243,6 @@ public: EmergeParams *emerge); static MapgenParams *createMapgenParams(MapgenType mgtype); static void getMapgenNames(std::vector *mgnames, bool include_hidden); - static void getMapgenDescriptions(std::vector *mgdescriptions, bool include_hidden); static void setDefaultSettings(Settings *settings); private: diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index e91d5eeed..1b35eef29 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -660,23 +660,6 @@ int ModApiMainMenu::l_get_mapgen_names(lua_State *L) return 1; } -/******************************************************************************/ -int ModApiMainMenu::l_get_mapgen_descriptions(lua_State *L) -{ - std::vector descriptions; - bool include_hidden = lua_isboolean(L, 1) && readParam(L, 1); - Mapgen::getMapgenDescriptions(&descriptions, include_hidden); - - lua_newtable(L); - for (size_t i = 0; i != descriptions.size(); i++) { - lua_pushstring(L, descriptions[i]); - lua_rawseti(L, -2, i + 1); - } - - return 1; -} - - /******************************************************************************/ int ModApiMainMenu::l_get_user_path(lua_State *L) { @@ -1075,7 +1058,6 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(set_background); API_FCT(set_topleft_text); API_FCT(get_mapgen_names); - API_FCT(get_mapgen_descriptions); API_FCT(get_user_path); API_FCT(get_modpath); API_FCT(get_modpaths); @@ -1117,7 +1099,6 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top) API_FCT(get_worlds); API_FCT(get_games); API_FCT(get_mapgen_names); - API_FCT(get_mapgen_descriptions); API_FCT(get_user_path); API_FCT(get_modpath); API_FCT(get_modpaths); diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index 6bfed8826..fc2d90af8 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -51,8 +51,6 @@ private: static int l_get_mapgen_names(lua_State *L); - static int l_get_mapgen_descriptions(lua_State *L); - static int l_get_language(lua_State *L); //packages From 0812aa57615c8665b2317f53c574721f9af33245 Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Tue, 17 Jun 2025 14:57:54 -0500 Subject: [PATCH 04/12] remove C++ structure elm --- src/mapgen/mapgen.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index e9db85eb3..e8c60c0de 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -62,7 +62,6 @@ const FlagDesc flagdesc_gennotify[] = { struct MapgenDesc { const char *name; bool is_user_visible; - const char *description; }; //// From 299d7c68a9afa5963f9273e41b8230fcec40f57d Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Tue, 17 Jun 2025 14:58:49 -0500 Subject: [PATCH 05/12] extra linebreak (?) --- src/script/lua_api/l_mainmenu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 1b35eef29..4b878ee1c 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -660,6 +660,7 @@ int ModApiMainMenu::l_get_mapgen_names(lua_State *L) return 1; } + /******************************************************************************/ int ModApiMainMenu::l_get_user_path(lua_State *L) { From 5f2b6968edb22ef1f3620e1db887a80780c038f1 Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Tue, 17 Jun 2025 15:08:22 -0500 Subject: [PATCH 06/12] remove unused var --- builtin/mainmenu/dlg_create_world.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 2a040db87..3aec36d28 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -140,7 +140,6 @@ local function create_world_formspec(dialogdata) end local mglist = "" - local mgdescription = "" local selindex do -- build the list of mapgens local i = 1 From 60afab8871fa0ef776505312082e056933b232db Mon Sep 17 00:00:00 2001 From: Xeno333 <149852758+Xeno333@users.noreply.github.com> Date: Sun, 22 Jun 2025 09:07:05 -0500 Subject: [PATCH 07/12] Update builtin/mainmenu/dlg_create_world.lua Co-authored-by: sfan5 --- builtin/mainmenu/dlg_create_world.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 3aec36d28..a08aee4b0 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -79,7 +79,7 @@ local mgv6_biomes = { } local mapgens_descriptions = { - v7 = fgettext("Default mapgen with large complex mountins and plains."), + v7 = fgettext("Default mapgen with large complex mountains and plains."), valleys = fgettext("Large valleys with complex terrain and rivers."), carpathian = fgettext("Realistic looking world with vast plains."), v5 = fgettext("Old mapgen."), From 9d5bdfe1581d193060fd0993a5a70934329dcb64 Mon Sep 17 00:00:00 2001 From: Xeno333 <149852758+Xeno333@users.noreply.github.com> Date: Sun, 22 Jun 2025 09:07:23 -0500 Subject: [PATCH 08/12] Update builtin/mainmenu/dlg_create_world.lua Co-authored-by: sfan5 --- builtin/mainmenu/dlg_create_world.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index a08aee4b0..71acf7d91 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -83,7 +83,7 @@ local mapgens_descriptions = { valleys = fgettext("Large valleys with complex terrain and rivers."), carpathian = fgettext("Realistic looking world with vast plains."), v5 = fgettext("Old mapgen."), - flat = fgettext("World Flat terrain."), + flat = fgettext("Flat world terrain"), fractal = fgettext("Wold with fractal structure."), singlenode = fgettext("Empty world, use for lua defined mapgens."), v6 = fgettext("Simple mapgen with few features, not recommended."), From b55fdb48dc7be7c270d9a060d5aa384a37d7229b Mon Sep 17 00:00:00 2001 From: Xeno333 <149852758+Xeno333@users.noreply.github.com> Date: Sun, 22 Jun 2025 09:07:39 -0500 Subject: [PATCH 09/12] Update builtin/mainmenu/dlg_create_world.lua Co-authored-by: sfan5 --- builtin/mainmenu/dlg_create_world.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 71acf7d91..20a797fc4 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -85,7 +85,7 @@ local mapgens_descriptions = { v5 = fgettext("Old mapgen."), flat = fgettext("Flat world terrain"), fractal = fgettext("Wold with fractal structure."), - singlenode = fgettext("Empty world, use for lua defined mapgens."), + singlenode = fgettext("Empty world, commonly used for Lua-defined mapgens"), v6 = fgettext("Simple mapgen with few features, not recommended."), } From 39b298dfadb93619f7e709329a5c44af6820524d Mon Sep 17 00:00:00 2001 From: Xeno333 <149852758+Xeno333@users.noreply.github.com> Date: Sun, 22 Jun 2025 09:07:49 -0500 Subject: [PATCH 10/12] Update builtin/mainmenu/dlg_create_world.lua Co-authored-by: sfan5 --- builtin/mainmenu/dlg_create_world.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 20a797fc4..38cffcfe1 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -84,7 +84,7 @@ local mapgens_descriptions = { carpathian = fgettext("Realistic looking world with vast plains."), v5 = fgettext("Old mapgen."), flat = fgettext("Flat world terrain"), - fractal = fgettext("Wold with fractal structure."), + fractal = fgettext("World with a fractal structure"), singlenode = fgettext("Empty world, commonly used for Lua-defined mapgens"), v6 = fgettext("Simple mapgen with few features, not recommended."), } From 670f4f12098bdfde6885a4e30f1a982ce77529a3 Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Sun, 22 Jun 2025 09:10:32 -0500 Subject: [PATCH 11/12] fix setneces and make list not vanish --- builtin/mainmenu/dlg_create_world.lua | 14 ++++++++------ mapgens/Superflat | 1 + mapgens/v8 | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) create mode 160000 mapgens/Superflat create mode 160000 mapgens/v8 diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 38cffcfe1..08455ea9d 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -79,14 +79,14 @@ local mgv6_biomes = { } local mapgens_descriptions = { - v7 = fgettext("Default mapgen with large complex mountains and plains."), - valleys = fgettext("Large valleys with complex terrain and rivers."), + v7 = fgettext("Default mapgen with large complex mountains and plains"), + valleys = fgettext("Large valleys with complex terrain and rivers"), carpathian = fgettext("Realistic looking world with vast plains."), - v5 = fgettext("Old mapgen."), + v5 = fgettext("Simple, but jagged landscape"), flat = fgettext("Flat world terrain"), fractal = fgettext("World with a fractal structure"), singlenode = fgettext("Empty world, commonly used for Lua-defined mapgens"), - v6 = fgettext("Simple mapgen with few features, not recommended."), + v6 = fgettext("Simple mapgen with few features"), } local function create_world_formspec(dialogdata) @@ -296,10 +296,12 @@ local function create_world_formspec(dialogdata) end + retval = retval .. + "label[0,2;" .. fgettext("Mapgen") .. "]".. + "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" + if mapgens_descriptions[current_mg] then retval = retval .. - "label[0,2;" .. fgettext("Mapgen") .. "]".. - "dropdown[0,2.5;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]".. "textarea[0.5,3.2;6,2;;;" .. mapgens_descriptions[current_mg] .. "]" end diff --git a/mapgens/Superflat b/mapgens/Superflat new file mode 160000 index 000000000..99b265a70 --- /dev/null +++ b/mapgens/Superflat @@ -0,0 +1 @@ +Subproject commit 99b265a706537aa30d6b538dbb25c0947e64f0d2 diff --git a/mapgens/v8 b/mapgens/v8 new file mode 160000 index 000000000..a15201d92 --- /dev/null +++ b/mapgens/v8 @@ -0,0 +1 @@ +Subproject commit a15201d92211bc03eb1bf9c6350ac31124f694a8 From 4c1dd04980a868d71323ca7bdcbd9f225dce06dd Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Sun, 22 Jun 2025 09:14:56 -0500 Subject: [PATCH 12/12] fix setneces and make list not vanish --- builtin/mainmenu/dlg_create_world.lua | 2 +- mapgens/Superflat | 1 - mapgens/v8 | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 160000 mapgens/Superflat delete mode 160000 mapgens/v8 diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 08455ea9d..12b5dcd33 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -81,7 +81,7 @@ local mgv6_biomes = { local mapgens_descriptions = { v7 = fgettext("Default mapgen with large complex mountains and plains"), valleys = fgettext("Large valleys with complex terrain and rivers"), - carpathian = fgettext("Realistic looking world with vast plains."), + carpathian = fgettext("Realistic looking world with vast plains"), v5 = fgettext("Simple, but jagged landscape"), flat = fgettext("Flat world terrain"), fractal = fgettext("World with a fractal structure"), diff --git a/mapgens/Superflat b/mapgens/Superflat deleted file mode 160000 index 99b265a70..000000000 --- a/mapgens/Superflat +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 99b265a706537aa30d6b538dbb25c0947e64f0d2 diff --git a/mapgens/v8 b/mapgens/v8 deleted file mode 160000 index a15201d92..000000000 --- a/mapgens/v8 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a15201d92211bc03eb1bf9c6350ac31124f694a8