From 7df8a3a3071f06cbe070c6353e208e3252e000bc Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 21 Sep 2019 18:11:54 +0200 Subject: [PATCH] More weather cleanup --- mods/weather/init.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mods/weather/init.lua b/mods/weather/init.lua index e269a7c..42eb5f7 100644 --- a/mods/weather/init.lua +++ b/mods/weather/init.lua @@ -63,6 +63,7 @@ local function setweather_type(type, do_repeat) end if valid then weather.weather = type + minetest.log("action", "[weather] Weather set to: "..weather.weather) update_sounds(do_repeat) return true else @@ -76,15 +77,20 @@ minetest.register_globalstep( if weather_pr:next(0, 5000) < 1 then local weathertype = weather_pr:next(0, 19) - -- on avg., every 1800 frames the weather.weather will change to one of: + -- on avg., every 1800 globalsteps, the weather.weather will change to one of: -- 13/20 chance of clear weather - -- 6/20 chance or stormy weather + -- 7/20 chance or stormy weather + local oldweather = weather.weather if weathertype < 13 then weather.weather = "clear" - elseif weathertype < 20 then + else weather.weather = "storm" end + if oldweather ~= weather.weather then + minetest.log("action", "[weather] Weather changed to: "..weather.weather) + update_sounds() + end end end