climate_api support - add distance fog

Add more appropriate/atmosphere distance fog to the nether, via climate_api mod to avoid conflicting with other mods.
Any game or server with climate_api mod installed will be expecting climate_api to take control of sky values.
This commit is contained in:
Treer
2021-02-02 19:15:51 +11:00
parent 00099f2aa2
commit 3008b167b2
5 changed files with 174 additions and 42 deletions

View File

@ -45,7 +45,6 @@ local BASALT_COLUMN_LOWER_LIMIT = CENTER_CAVERN_LIMIT * 0.25 -- This value
-- Shared Nether mapgen namespace
-- For mapgen files to share functions and constants
nether.mapgen = {}
local mapgen = nether.mapgen
mapgen.TCAVE = TCAVE -- const needed in mapgen_mantle.lua
@ -257,6 +256,19 @@ mapgen.np_cave = {
--flags = ""
}
local cavePointPerlin = nil
mapgen.getCavePointPerlin = function()
cavePointPerlin = cavePointPerlin or minetest.get_perlin(mapgen.np_cave)
return cavePointPerlin
end
mapgen.getCavePerlinAt = function(pos)
cavePointPerlin = cavePointPerlin or minetest.get_perlin(mapgen.np_cave)
return cavePointPerlin:get3d(pos)
end
-- Buffers and objects we shouldn't recreate every on_generate
local nobj_cave = nil
@ -658,7 +670,7 @@ end
-- use knowledge of the nether mapgen algorithm to return a suitable ground level for placing a portal.
-- player_name is optional, allowing a player to spawn a remote portal in their own protected areas.
function nether.find_nether_ground_y(target_x, target_z, start_y, player_name)
local nobj_cave_point = minetest.get_perlin(mapgen.np_cave)
local nobj_cave_point = mapgen.getCavePointPerlin()
local air = 0 -- Consecutive air nodes found
local minp_schem, maxp_schem = nether.get_schematic_volume({x = target_x, y = 0, z = target_z}, nil, "nether_portal")