diff --git a/API.md b/API.md index 21f595a..7713bf2 100644 --- a/API.md +++ b/API.md @@ -10,13 +10,9 @@ If you use these in any other mapgen, bad things might happen. ### `biomeinfo.get_v6_humidity(pos)` Get the biome humidity at pos (for v6 mapgen). -This function might fail and return nil. - ### `biomeinfo.get_v6_heat(pos)` Get the biome heat/temperature at pos (for v6 mapgen). -This function might fail and return nil. - ### `biomeinfo.get_v6_biome(pos)` Get the v6 biome at pos. Returns a string, which is the unique biome name. diff --git a/init.lua b/init.lua index 3740e0a..5013647 100644 --- a/init.lua +++ b/init.lua @@ -19,6 +19,28 @@ local seed = tonumber(minetest.get_mapgen_setting("seed")) or 0 local mgv6_perlin_biome, mgv6_perlin_humidity, mgv6_np_biome +-- v6 default noiseparams are hardcoded here because Minetest doesn't give us those +local mgv6_np_biome_default = { + offset = 0, + scale = 1, + spread = { x = 500, y = 500, z = 500}, + seed = 9130, + octaves = 3, + persistence = 0.50, + lacunarity = 2.0, + flags = "eased", +} +local mgv6_np_humidity_default = { + offset = 0.5, + scale = 0.5, + spread = { x = 500, y = 500, z = 500}, + seed = 72384, + octaves = 3, + persistence = 0.50, + lacunarity = 2.0, + flags = "eased", +} + local v6_flags_str = minetest.get_mapgen_setting("mgv6_spflags") if v6_flags_str == nil then v6_flags_str = "" @@ -86,15 +108,19 @@ biomeinfo.all_v6_biomes = { local function init_perlins() if not mgv6_perlin_biome then mgv6_np_biome = minetest.get_mapgen_setting_noiseparams("mgv6_np_biome") - if mgv6_np_biome then - mgv6_perlin_biome = minetest.get_perlin(mgv6_np_biome) + if not mgv6_np_biome then + mgv6_np_biome = mgv6_np_biome_default + minetest.log("action", "[biomeinfo] Using hardcoded mgv6_np_biome default") end + mgv6_perlin_biome = minetest.get_perlin(mgv6_np_biome) end if not mgv6_perlin_humidity then local np_humidity = minetest.get_mapgen_setting_noiseparams("mgv6_np_humidity") - if np_humidity then - mgv6_perlin_humidity = minetest.get_perlin(np_humidity) + if not np_humidity then + np_humidity = mgv6_np_humidity_default + minetest.log("action", "[biomeinfo] Using hardcoded mgv6_np_humidity default") end + mgv6_perlin_humidity = minetest.get_perlin(np_humidity) end end