From de45af5e794524c543dffcd66afb5d87e1e4b5d6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 12 Nov 2017 01:36:37 +0100 Subject: [PATCH] Tweak sky color on rain and thunderstorm --- mods/ENVIRONMENT/weather_pack/rain.lua | 22 ++++++++++++---------- mods/ENVIRONMENT/weather_pack/thunder.lua | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/mods/ENVIRONMENT/weather_pack/rain.lua b/mods/ENVIRONMENT/weather_pack/rain.lua index f3c7a6f52a..63e3467990 100644 --- a/mods/ENVIRONMENT/weather_pack/rain.lua +++ b/mods/ENVIRONMENT/weather_pack/rain.lua @@ -25,16 +25,18 @@ end -- set skybox based on time (uses skycolor api) rain.set_sky_box = function() - skycolor.add_layer( - "weather-pack-rain-sky", - {{r=0, g=0, b=0}, - {r=85, g=86, b=98}, - {r=152, g=150, b=159}, - {r=85, g=86, b=98}, - {r=0, g=0, b=0}}) - skycolor.active = true - for _, player in pairs(minetest.get_connected_players()) do - player:set_clouds({color="#3D3D3FE8"}) + if weather.state == "rain" then + skycolor.add_layer( + "weather-pack-rain-sky", + {{r=0, g=0, b=0}, + {r=85, g=86, b=98}, + {r=175, g=175, b=191}, + {r=85, g=86, b=98}, + {r=0, g=0, b=0}}) + skycolor.active = true + for _, player in pairs(minetest.get_connected_players()) do + player:set_clouds({color="#5D5D5FE8"}) + end end end diff --git a/mods/ENVIRONMENT/weather_pack/thunder.lua b/mods/ENVIRONMENT/weather_pack/thunder.lua index 1cd61fa3fe..7b87bb2be9 100644 --- a/mods/ENVIRONMENT/weather_pack/thunder.lua +++ b/mods/ENVIRONMENT/weather_pack/thunder.lua @@ -5,6 +5,7 @@ thunder = { next_strike = 0, min_delay = 3, max_delay = 12, + init_done = false, } minetest.register_globalstep(function(dtime) @@ -13,6 +14,21 @@ minetest.register_globalstep(function(dtime) end rain.make_weather() + + if thunder.init_done == false then + skycolor.add_layer( + "weather-pack-thunder-sky", + {{r=0, g=0, b=0}, + {r=40, g=40, b=40}, + {r=85, g=86, b=86}, + {r=40, g=40, b=40}, + {r=0, g=0, b=0}}) + skycolor.active = true + for _, player in pairs(minetest.get_connected_players()) do + player:set_clouds({color="#3D3D3FE8"}) + end + thunder.init_done = true + end if (thunder.next_strike <= minetest.get_gametime()) then lightning.strike() @@ -24,6 +40,9 @@ end) thunder.clear = function() rain.clear() + skycolor.remove_layer("weather-pack-thunder-sky") + skycolor.remove_layer("lightning") + thunder.init_done = false end -- register thunderstorm weather