From 231b44615f89ad41601295adc680f8e27016facc Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Tue, 10 Jun 2025 18:29:29 -0500 Subject: [PATCH] Fix mapgen selection problem and whitespaces(?) --- builtin/mainmenu/dlg_create_world.lua | 10 +++++----- mapgens/egen/init.lua | 1 + mapgens/egen/mapgen.conf | 5 +++++ src/content/mod_configuration.h | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 mapgens/egen/init.lua create mode 100644 mapgens/egen/mapgen.conf diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 39d6f3c42..8423bfdb6 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -87,11 +87,6 @@ local function create_world_formspec(dialogdata) mapgens[#mapgens+1] = k end - local current_mapgen_internal = dialogdata.mg - if lua_mapgens[current_mapgen_internal] then - current_mapgen_internal = "singlenode" - end - local flags = dialogdata.flags local game = pkgmgr.find_by_gameid(core.settings:get("menu_last_game")) @@ -159,6 +154,11 @@ local function create_world_formspec(dialogdata) mglist = mglist:sub(1, -2) end + local current_mapgen_internal = current_mapgen + if lua_mapgens[current_mapgen_internal] and current_mapgen == dialogdata.mg then + current_mapgen_internal = "singlenode" + end + -- The logic of the flag element IDs is as follows: -- "flag_main_foo-bar-baz" controls dialogdata.flags["main"]["foo_bar_baz"] -- see the buttonhandler for the implementation of this diff --git a/mapgens/egen/init.lua b/mapgens/egen/init.lua new file mode 100644 index 000000000..6e79622ed --- /dev/null +++ b/mapgens/egen/init.lua @@ -0,0 +1 @@ +print("Loaded Egen!") \ No newline at end of file diff --git a/mapgens/egen/mapgen.conf b/mapgens/egen/mapgen.conf new file mode 100644 index 000000000..d41938638 --- /dev/null +++ b/mapgens/egen/mapgen.conf @@ -0,0 +1,5 @@ +name = egen +title = Egen +description = Example mapgen. +author = TX_Miner/Xeno333 +mapgen = true \ No newline at end of file diff --git a/src/content/mod_configuration.h b/src/content/mod_configuration.h index 4c7cd8cae..f0554699f 100644 --- a/src/content/mod_configuration.h +++ b/src/content/mod_configuration.h @@ -74,7 +74,7 @@ public: */ void addMapgenFromConfig(const std::string &settings_path, const std::unordered_map &mapgenPaths); - + /** * Call this function once all mods have been added */