Add support for 'seed' in disallow_mapgen_settings (#12023)

This commit is contained in:
Wuzzy 2022-02-12 19:23:58 +00:00 committed by GitHub
parent 0cd9c5b5be
commit 10cf2f3edd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

@ -315,12 +315,17 @@ local function create_world_formspec(dialogdata)
"field[0.3,0.6;6,0.5;te_world_name;" .. "field[0.3,0.6;6,0.5;te_world_name;" ..
fgettext("World name") .. fgettext("World name") ..
";" .. core.formspec_escape(dialogdata.worldname) .. "]" .. ";" .. core.formspec_escape(dialogdata.worldname) .. "]" ..
"set_focus[te_world_name;false]" .. "set_focus[te_world_name;false]"
"field[0.3,1.7;6,0.5;te_seed;" .. if not disallowed_mapgen_settings["seed"] then
fgettext("Seed") ..
";".. core.formspec_escape(dialogdata.seed) .. "]" ..
retval = retval .. "field[0.3,1.7;6,0.5;te_seed;" ..
fgettext("Seed") ..
";".. core.formspec_escape(dialogdata.seed) .. "]"
end
retval = retval ..
"label[0,2;" .. fgettext("Mapgen") .. "]".. "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 .. "]"
@ -391,7 +396,7 @@ local function create_world_buttonhandler(this, fields)
end end
if message == nil then if message == nil then
this.data.seed = fields["te_seed"] this.data.seed = fields["te_seed"] or ""
this.data.mg = fields["dd_mapgen"] this.data.mg = fields["dd_mapgen"]
-- actual names as used by engine -- actual names as used by engine
@ -426,7 +431,7 @@ local function create_world_buttonhandler(this, fields)
end end
this.data.worldname = fields["te_world_name"] this.data.worldname = fields["te_world_name"]
this.data.seed = fields["te_seed"] this.data.seed = fields["te_seed"] or ""
if fields["games"] then if fields["games"] then
local gameindex = core.get_textlist_index("games") local gameindex = core.get_textlist_index("games")

@ -78,7 +78,7 @@ The game directory can contain the following files:
* `disallowed_mapgen_settings= <comma-separated mapgen settings>` * `disallowed_mapgen_settings= <comma-separated mapgen settings>`
e.g. `disallowed_mapgen_settings = mgv5_spflags` e.g. `disallowed_mapgen_settings = mgv5_spflags`
These mapgen settings are hidden for this game in the world creation These mapgen settings are hidden for this game in the world creation
dialog and game start menu. dialog and game start menu. Add `seed` to hide the seed input field.
* `disabled_settings = <comma-separated settings>` * `disabled_settings = <comma-separated settings>`
e.g. `disabled_settings = enable_damage, creative_mode` e.g. `disabled_settings = enable_damage, creative_mode`
These settings are hidden for this game in the "Start game" tab These settings are hidden for this game in the "Start game" tab