diff --git a/mods/ENVIRONMENT/weather_pack/rain.lua b/mods/ENVIRONMENT/weather_pack/rain.lua index 418972c68d..fad3b0dcc9 100644 --- a/mods/ENVIRONMENT/weather_pack/rain.lua +++ b/mods/ENVIRONMENT/weather_pack/rain.lua @@ -175,13 +175,6 @@ rain.make_weather = function() end end -if weather.reg_weathers.rain == nil then - weather.reg_weathers.rain = { - chance = 15, - clear = rain.clear - } -end - -- Switch the number of raindrops: "thunder" for many raindrops, otherwise for normal raindrops rain.set_particles_mode = function(mode) if mode == "thunder" then @@ -242,3 +235,13 @@ if weather.allow_abm then end }) end + +if weather.reg_weathers.rain == nil then + weather.reg_weathers.rain = { + chance = 15, + clear = rain.clear, + -- 10min - 20min + min_duration = 300, + max_duration = 600, + } +end diff --git a/mods/ENVIRONMENT/weather_pack/snow.lua b/mods/ENVIRONMENT/weather_pack/snow.lua index 2ab2716d46..8a98c3e8f5 100644 --- a/mods/ENVIRONMENT/weather_pack/snow.lua +++ b/mods/ENVIRONMENT/weather_pack/snow.lua @@ -84,7 +84,10 @@ end) if weather.reg_weathers.snow == nil then weather.reg_weathers.snow = { chance = 10, - clear = snow.clear + clear = snow.clear, + -- 10min - 20min + min_duration = 300, + max_duration = 600, } end diff --git a/mods/ENVIRONMENT/weather_pack/thunder.lua b/mods/ENVIRONMENT/weather_pack/thunder.lua index 91ce34df8d..afe8835db9 100644 --- a/mods/ENVIRONMENT/weather_pack/thunder.lua +++ b/mods/ENVIRONMENT/weather_pack/thunder.lua @@ -51,7 +51,8 @@ if weather.reg_weathers.thunder == nil then weather.reg_weathers.thunder = { chance = 5, clear = thunder.clear, - min_duration = 120, + -- 10min - 20min + min_duration = 300, max_duration = 600, } end diff --git a/mods/ENVIRONMENT/weather_pack/weather_core.lua b/mods/ENVIRONMENT/weather_pack/weather_core.lua index ed555b99a4..c3b2e40c84 100644 --- a/mods/ENVIRONMENT/weather_pack/weather_core.lua +++ b/mods/ENVIRONMENT/weather_pack/weather_core.lua @@ -9,13 +9,13 @@ weather = { next_check = 0, -- default weather recalculation interval - check_interval = 300, + check_interval = 150, -- weather min duration - min_duration = 240, + min_duration = 300, -- weather max duration - max_duration = 3600, + max_duration = 9000, -- weather calculated end time end_time = nil, @@ -152,6 +152,7 @@ minetest.register_chatcommand("weather", { weather.reg_weathers[weather.state].clear() end weather.state = "none" + weather.end_time = weather.get_rand_end_time() success = true return end @@ -159,6 +160,8 @@ minetest.register_chatcommand("weather", { if (weather.reg_weathers ~= nil and weather.reg_weathers[param] ~= nil) then if (weather.state ~= nil and weather.state ~= "none" and weather.reg_weathers[weather.state] ~= nil) then weather.reg_weathers[weather.state].clear() + local weather_meta = weather.reg_weathers[weather.state] + weather.end_time = weather.get_rand_end_time(weather_meta.min_duration, weather_meta.max_duration) end weather.state = param return @@ -179,6 +182,8 @@ minetest.register_chatcommand("toggledownfall", { weather.reg_weathers[weather.state].clear() end weather.state = "none" + weather.end_time = weather.get_rand_end_time() + -- Currently clear: Set weather randomly to rain/thunder/snow else local new = { "rain", "thunder", "snow" } @@ -187,6 +192,8 @@ minetest.register_chatcommand("toggledownfall", { weather.reg_weathers[weather.state].clear() end weather.state = new[r] + local weather_meta = weather.reg_weathers[weather.state] + weather.end_time = weather.get_rand_end_time(weather_meta.min_duration, weather_meta.max_duration) end end })