From 35b2f3b6384a0cfe1046de73ddee43148f728991 Mon Sep 17 00:00:00 2001 From: FossFanatic Date: Wed, 21 Dec 2022 13:01:54 +0000 Subject: [PATCH] Make overworld biome specific (daytime) sky and fog colours possible --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 35 ++++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 7bc3ad1fe..7b25fbe9a 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -3,19 +3,26 @@ local NIGHT_VISION_RATIO = 0.45 local water_color = "#0b4880" -function mcl_weather.set_sky_box_clear(player) - 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 - player:set_sky({ - type = "regular", - sky_color = { - day_sky = "#92B9FF", - day_horizon = "#B4D0FF", +local mg_name = minetest.get_mapgen_setting("mg_name") + +function mcl_weather.set_sky_box_clear(player,sky,fog) + local sc = { + day_sky = "#0000FF", --Pure blue to make debugging this stuff easier. The biome's sky colours are supposed to overwrite this. + day_horizon = "#FF0000", --Pure red to make debugging this stuff easier. The biome's fog (horizon) colours are supposed to overwrite this. dawn_sky = "#B4BAFA", dawn_horizon = "#BAC1F0", night_sky = "#000000", 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, }) end @@ -124,9 +131,17 @@ mcl_weather.skycolor = { }) end 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 -- 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_moon({visible = true}) player:set_stars({visible = true})