From 5e65307819479c25f15230c3a9666a477eeeacea Mon Sep 17 00:00:00 2001 From: kay27 Date: Thu, 28 Jan 2021 17:55:33 +0400 Subject: [PATCH] Fix https://git.minetest.land/Wuzzy/MineClone2/issues/897 --- mods/ENVIRONMENT/mcl_weather/weather_core.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/weather_core.lua b/mods/ENVIRONMENT/mcl_weather/weather_core.lua index a1920308f8..365f6e549c 100644 --- a/mods/ENVIRONMENT/mcl_weather/weather_core.lua +++ b/mods/ENVIRONMENT/mcl_weather/weather_core.lua @@ -166,14 +166,25 @@ end -- gametime (minetest.get_gametime) in which the weather ends. -- * changer is OPTIONAL, for logging purposes. mcl_weather.change_weather = function(new_weather, explicit_end_time, changer_name) - local changer_name = changer_name or debug.getinfo(2).name + local changer_name = changer_name or debug.getinfo(2).name.."()" if (mcl_weather.reg_weathers ~= nil and mcl_weather.reg_weathers[new_weather] ~= nil) then if (mcl_weather.state ~= nil and mcl_weather.reg_weathers[mcl_weather.state] ~= nil) then mcl_weather.reg_weathers[mcl_weather.state].clear() end - minetest.log("action", "[mcl_weather] " .. changer_name .. " changed the weather from " .. mcl_weather.state .. " to " .. new_weather) + + local old_weather = mcl_weather.state + mcl_weather.state = new_weather + + if old_weather == "none" then + old_weather = "clear" + end + if new_weather == "none" then + new_weather = "clear" + end + minetest.log("action", "[mcl_weather] " .. changer_name .. " changed the weather from " .. old_weather .. " to " .. new_weather) + local weather_meta = mcl_weather.reg_weathers[mcl_weather.state] if explicit_end_time then mcl_weather.end_time = explicit_end_time