From eaf55653bbdaea9eca32190c06e4a656f05aa9d2 Mon Sep 17 00:00:00 2001 From: Xeno333 Date: Sat, 7 Jun 2025 16:05:58 -0500 Subject: [PATCH 1/2] Add default_mapgen game setting --- builtin/mainmenu/dlg_create_world.lua | 9 +++++++-- doc/lua_api.md | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 27fe68050..b143c7275 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -80,7 +80,7 @@ local mgv6_biomes = { local function create_world_formspec(dialogdata) - local current_mg = dialogdata.mg + local current_mg = dialogdata.mg or core.settings:get("mg_name") local mapgens = core.get_mapgen_names() local flags = dialogdata.flags @@ -96,6 +96,11 @@ local function create_world_formspec(dialogdata) if game ~= nil then local gameconfig = Settings(game.path.."/game.conf") + local game_default_mg = gameconfig:get("default_mapgen") + if dialogdata.mg == nil and game_default_mg then + current_mg = game_default_mg + end + local allowed_mapgens = (gameconfig:get("allowed_mapgens") or ""):split() for key, value in pairs(allowed_mapgens) do allowed_mapgens[key] = value:trim() @@ -456,7 +461,7 @@ function create_create_world_dlg() worldname = "", -- settings the world is created with: seed = core.settings:get("fixed_map_seed") or "", - mg = core.settings:get("mg_name"), + mg = nil, flags = { main = core.settings:get_flags("mg_flags"), v5 = core.settings:get_flags("mgv5_spflags"), diff --git a/doc/lua_api.md b/doc/lua_api.md index ca3a5fee7..412136b06 100644 --- a/doc/lua_api.md +++ b/doc/lua_api.md @@ -84,6 +84,9 @@ The game directory can contain the following files: When both `allowed_mapgens` and `disallowed_mapgens` are specified, `allowed_mapgens` is applied before `disallowed_mapgens`. + * `default_mapgen` + e.g. `default_mapgen = valleys` + Set default mapgen for game, this will be the default selection when creating a new world. * `disallowed_mapgen_settings= ` e.g. `disallowed_mapgen_settings = mgv5_spflags` These mapgen settings are hidden for this game in the world creation From 7d075d4fcb6de2c6f2766b9d81a5dacc3619e3e9 Mon Sep 17 00:00:00 2001 From: Xeno333 <149852758+Xeno333@users.noreply.github.com> Date: Sat, 7 Jun 2025 22:30:38 -0500 Subject: [PATCH 2/2] Remove extra nil I set mg to nil initaly but just remembered it is the same as deleating it... --- 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 b143c7275..f11f8ca1f 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -461,7 +461,6 @@ function create_create_world_dlg() worldname = "", -- settings the world is created with: seed = core.settings:get("fixed_map_seed") or "", - mg = nil, flags = { main = core.settings:get_flags("mg_flags"), v5 = core.settings:get_flags("mgv5_spflags"),