Skip to content

Commit dde4636

Browse files
authored
Add default_mapgen game setting (#16238)
1 parent 4f8a847 commit dde4636

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

builtin/mainmenu/dlg_create_world.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ local function create_world_formspec(dialogdata)
9696
if game ~= nil then
9797
local gameconfig = Settings(game.path.."/game.conf")
9898

99+
current_mg = current_mg or gameconfig:get("default_mapgen") or core.settings:get("mg_name")
100+
99101
local allowed_mapgens = (gameconfig:get("allowed_mapgens") or ""):split()
100102
for key, value in pairs(allowed_mapgens) do
101103
allowed_mapgens[key] = value:trim()
@@ -456,7 +458,6 @@ function create_create_world_dlg()
456458
worldname = "",
457459
-- settings the world is created with:
458460
seed = core.settings:get("fixed_map_seed") or "",
459-
mg = core.settings:get("mg_name"),
460461
flags = {
461462
main = core.settings:get_flags("mg_flags"),
462463
v5 = core.settings:get_flags("mgv5_spflags"),

doc/lua_api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ The game directory can contain the following files:
8484
When both `allowed_mapgens` and `disallowed_mapgens` are
8585
specified, `allowed_mapgens` is applied before
8686
`disallowed_mapgens`.
87+
* `default_mapgen`
88+
e.g. `default_mapgen = valleys`
89+
Set default mapgen for game, this will be the default selection when creating a new world.
8790
* `disallowed_mapgen_settings= <comma-separated mapgen settings>`
8891
e.g. `disallowed_mapgen_settings = mgv5_spflags`
8992
These mapgen settings are hidden for this game in the world creation

0 commit comments

Comments
 (0)