Skip to content

Commit

Permalink
Replace noise params
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed Jan 1, 2025
1 parent 7f0bcf3 commit 1bef518
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
18 changes: 16 additions & 2 deletions builtin/common/settings/components.lua
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,22 @@ local function make_noise_params(setting)
}
end

make.noise_params_2d = make_noise_params
make.noise_params_3d = make_noise_params
if INIT == "pause_menu" then
-- 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
19 changes: 11 additions & 8 deletions builtin/common/settings/dlg_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -765,16 +765,19 @@ local function eventhandler(event)
end


function create_settings_dlg()
load()
local dlg = dialog_create("dlg_settings", get_formspec, buttonhandler, eventhandler)
if INIT == "mainmenu" then
function create_settings_dlg()
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
end
return dlg
end

else
assert(INIT == "pause_menu")

if INIT == "pause_menu" then
local dialog

core.register_on_formspec_input(function(formname, fields)
Expand All @@ -790,7 +793,7 @@ if INIT == "pause_menu" then
load()
dialog = {}
dialog.data = {}
dialog.page_id = update_filtered_pages("")
dialog.data.page_id = update_filtered_pages("")
dialog.delete = function()
dialog = nil
end
Expand Down

0 comments on commit 1bef518

Please sign in to comment.