fix various little errors

This commit is contained in:
cora 2021-09-27 02:31:18 +02:00
parent 53603050c0
commit cd67354725
3 changed files with 8 additions and 6 deletions

View File

@ -191,6 +191,7 @@ function mcl_weather.stop_weather(def)
end)
if def.skylayer then
mcl_weather.skycolor.remove_layer("weather")
mcl_weather.skycolor.force_update=true
mcl_weather.skycolor.update_sky_color()
end
end
@ -310,7 +311,7 @@ minetest.register_chatcommand("weather", {
local def=mcl_weather.get_weatherdef(param)
local old_weather=mcl_weather.current
if def then
mcl_weather.stop_weather(mcl_weather.get_weatherdef(mcl_weather.state))
mcl_weather.stop_weather(mcl_weather.get_weatherdef(mcl_weather.current))
if duration then
def.min_duration=duration
def.max_duration=duration
@ -330,7 +331,7 @@ minetest.register_chatcommand("toggledownfall", {
func = function(name, param)
-- Currently rain/thunder/snow: Set weather to clear
if mcl_weather.state ~= "none" then
mcl_weather.change("none")
mcl_weather.change("none",true)
-- Currently clear: Set weather randomly to rain/thunder/snow
else

View File

@ -6,6 +6,7 @@ mcl_weather.rain = {
raining = false
}
mcl_weather.raining = false
mcl_weather.register_weather("rain",{
light_factor = 0.6,
cloudcolor= "#5D5D5FE8" ,
@ -26,14 +27,14 @@ mcl_weather.register_weather("rain",{
{
amount = 800,
time = 0,
minpos = vector.new(-5,5,-5),
maxpos =vector.new(5,10,5),
minpos = vector.new(-10,10,-10),
maxpos =vector.new(10,15,10),
minvel = vector.new(0,-8,0),
maxvel = vector.new(0,-12,0),
minacc = vector.new(0,-20,0),
maxacc = vector.new(0,-30,0),
minexptime = 1,
maxexptime = 1,
maxexptime = 2,
minsize = 0.5,
maxsize = 5,
collisiondetection = true,

View File

@ -70,7 +70,7 @@ mcl_weather.skycolor = {
else
arg = ratio
end
player:override_day_night_ratio(arg)
if arg and arg >= 0 and arg <= 1 then player:override_day_night_ratio(arg) end
end,
-- Update sky color. If players not specified update sky for all players.