Replace noise params

This commit is contained in:
grorp 2025-01-01 21:06:37 +01:00
parent f766463b3c
commit 30951070a0
2 changed files with 27 additions and 10 deletions

View File

@ -430,8 +430,22 @@ local function make_noise_params(setting)
} }
end end
make.noise_params_2d = make_noise_params if INIT == "pause_menu" then
make.noise_params_3d = make_noise_params -- Making the noise parameter dialog work in the pause menu settings would
-- require porting "FSTK" (at least the dialog API) from the mainmenu formspec
-- API to the in-game formspec API.
-- There's no reason you'd want to adjust mapgen noise parameter settings
-- in-game (they only apply to new worlds), so there's no reason to implement
-- this.
local empty = function()
return { get_formspec = function() return "", 0 end }
end
make.noise_params_2d = empty
make.noise_params_3d = empty
else
make.noise_params_2d = make_noise_params
make.noise_params_3d = make_noise_params
end
return make return make

View File

@ -765,16 +765,19 @@ local function eventhandler(event)
end end
function create_settings_dlg() if INIT == "mainmenu" then
load() function create_settings_dlg()
local dlg = dialog_create("dlg_settings", get_formspec, buttonhandler, eventhandler) load()
local dlg = dialog_create("dlg_settings", get_formspec, buttonhandler, eventhandler)
dlg.data.page_id = update_filtered_pages("") dlg.data.page_id = update_filtered_pages("")
return dlg return dlg
end end
else
assert(INIT == "pause_menu")
if INIT == "pause_menu" then
local dialog local dialog
core.register_on_formspec_input(function(formname, fields) core.register_on_formspec_input(function(formname, fields)
@ -790,7 +793,7 @@ if INIT == "pause_menu" then
load() load()
dialog = {} dialog = {}
dialog.data = {} dialog.data = {}
dialog.page_id = update_filtered_pages("") dialog.data.page_id = update_filtered_pages("")
dialog.delete = function() dialog.delete = function()
dialog = nil dialog = nil
end end