fix incompatibility with old mcl_weather

This commit is contained in:
cora 2021-09-26 03:26:41 +02:00
parent bb0f33e21b
commit b5b249b722
1 changed files with 14 additions and 1 deletions

View File

@ -21,7 +21,7 @@ local interval=1
function mcl_weather.register_weather(name,def)
mcl_weather.registered_weathers[name] = def
end
local modpath=minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/skycolor.lua")
dofile(modpath.."/snow.lua")
dofile(modpath.."/rain.lua")
@ -35,6 +35,19 @@ function mcl_weather.get_weatherdef(name)
return mcl_weather.registered_weathers["none"]
end
function mcl_weather.get_weather()
return mcl_weather.current
end
function mcl_weather.get_current_light_factor()
local lf = mcl_weather.get_weatherdef(mcl_weather.current).light_factor
if mcl_weather.current == "none" or not lf then
return nil
else
return lf
end
end
-- Returns true if pos is outdoor.
-- Outdoor is defined as any node in the Overworld under open sky.
-- FIXME: Nodes below glass also count as “outdoor”, this should not be the case.