Make overworld biome specific (daytime) sky and fog colours possible

This commit is contained in:
FossFanatic 2022-12-21 13:01:54 +00:00
parent a6e0da0e07
commit 35b2f3b638
1 changed files with 25 additions and 10 deletions

View File

@ -3,19 +3,26 @@ local NIGHT_VISION_RATIO = 0.45
local water_color = "#0b4880" local water_color = "#0b4880"
function mcl_weather.set_sky_box_clear(player) local mg_name = minetest.get_mapgen_setting("mg_name")
local pos = player:get_pos()
if minetest.get_item_group(minetest.get_node(vector.new(pos.x,pos.y+1.5,pos.z)).name, "water") ~= 0 then return end function mcl_weather.set_sky_box_clear(player,sky,fog)
player:set_sky({ local sc = {
type = "regular", day_sky = "#0000FF", --Pure blue to make debugging this stuff easier. The biome's sky colours are supposed to overwrite this.
sky_color = { day_horizon = "#FF0000", --Pure red to make debugging this stuff easier. The biome's fog (horizon) colours are supposed to overwrite this.
day_sky = "#92B9FF",
day_horizon = "#B4D0FF",
dawn_sky = "#B4BAFA", dawn_sky = "#B4BAFA",
dawn_horizon = "#BAC1F0", dawn_horizon = "#BAC1F0",
night_sky = "#000000", night_sky = "#000000",
night_horizon = "#4A6790", night_horizon = "#4A6790",
}, }
if sky then
sc.day_sky = sky
end
if fog then
sc.day_horizon = fog
end
player:set_sky({
type = "regular",
sky_color = sc,
clouds = true, clouds = true,
}) })
end end
@ -124,9 +131,17 @@ mcl_weather.skycolor = {
}) })
end end
if dim == "overworld" then if dim == "overworld" then
local biomesky
local biomefog
if mg_name ~= "v6" and mg_name ~= "singlenode" then
local biome = minetest.get_biome_name(minetest.get_biome_data(player:get_pos()).biome)
biomesky = minetest.registered_biomes[biome]._mcl_skycolor
biomefog = minetest.registered_biomes[biome]._mcl_fogcolor
end
if (mcl_weather.state == "none") then if (mcl_weather.state == "none") then
-- Clear weather -- Clear weather
mcl_weather.set_sky_box_clear(player) mcl_weather.set_sky_box_clear(player,biomesky,biomefog)
player:set_sun({visible = true, sunrise_visible = true}) player:set_sun({visible = true, sunrise_visible = true})
player:set_moon({visible = true}) player:set_moon({visible = true})
player:set_stars({visible = true}) player:set_stars({visible = true})