Add setting to set default noiseparams

This commit is contained in:
Wuzzy 2022-04-20 17:03:56 +02:00
parent bb71187214
commit 11c4e50150
2 changed files with 16 additions and 4 deletions

View File

@ -98,9 +98,16 @@ local default_noiseparams = {
octaves = 2,
persistence = 0.5,
lacunarity = 2.0,
flags = "defaults,noabsvalue",
flags = "defaults",
}
-- Get default noise params by setting (if available)
local np_by_setting = minetest.settings:get_np_group("perlin_explorer_default_noiseparams")
if np_by_setting then
default_noiseparams = np_by_setting
minetest.log("info", "[perlin_explorer] default noiseparams read from setting")
end
-- Holds the currently used Perlin noise
local current_perlin = {}
-- holds the current PerlinNoise object
@ -1620,10 +1627,12 @@ end)
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
local flags = default_noiseparams.flags
local flags_table = parse_flags_string(flags)
formspec_states[name] = {
defaults = true,
eased = false,
absvalue = false,
defaults = flags_table.defaults,
eased = flags_table.eased,
absvalue = flags_table.absvalue,
sidelen = 1,
noiseparams = table.copy(default_noiseparams),
}

View File

@ -1,3 +1,6 @@
# The default noise parameters that this mod will start with.
perlin_explorer_default_noiseparams (Default noise parameters) noise_params_3d 0, 1, (10, 10, 10), 0, 2, 0.5, 2.0, defaults
# Number of available colors to use per node color palette,
# ignoring the special “extreme” colors (which are always used).
# High values lead to a smoother color gradient but also might