if minetest.global_exists("hw_utils") then local np_temp = { offset = 50, scale = 50, spread = {x = 500, y = 500, z = 500}, seed = 5349, octaves = 3, persist = 0.5, lacunarity = 2.0 } local np_humid = { offset = 50, scale = 50, spread = {x = 500, y = 500, z = 500}, seed = 842, octaves = 3, persist = 0.5, lacunarity = 2.0 } local is_biome_frozen = function(position) local posx = math.floor(position.x) local posz = math.floor(position.z) local noise_obj = minetest.get_perlin(np_temp) local noise_temp = noise_obj:get2d({x = posx, y = posz}) -- below 35 heat biome considered to be frozen type return noise_temp < 35 end hw_utils.is_biome_frozen = function(position) return is_biome_frozen(position) end local is_biome_dry = function(position) local posx = math.floor(position.x) local posz = math.floor(position.z) local noise_obj = minetest.get_perlin(np_humid) local noise_humid = noise_obj:get2d({x = posx, y = posz}) -- below 50 humid biome considered to be dry type (at least by this mod) return noise_humid < 50 end hw_utils.is_biome_dry = function(position) return is_biome_dry(position) end local is_biome_tropic = function(position) local posx = math.floor(position.x) local posz = math.floor(position.z) local noise_obj = minetest.get_perlin(np_humid) local noise_humid = noise_obj:get2d({x = posx, y = posz}) noise_obj = minetest.get_perlin(np_temp) local noise_temp = noise_obj:get2d({x = posx, y = posz}) -- humid and temp values are taked by testing flying around world (not sure actually) return noise_humid > 55 and noise_temp > 80 end hw_utils.is_biome_tropic = function(position) return is_biome_tropic(position) end end minetest.log("action", "[nalc_weather] loaded.")