forked from Mineclonia/Mineclonia
fix thunder/lightning never stopping
This commit is contained in:
parent
e854be9f0f
commit
8f619ab5c3
|
@ -2,12 +2,20 @@ mcl_weather.thunder = {
|
||||||
min_delay = 3,
|
min_delay = 3,
|
||||||
max_delay = 12
|
max_delay = 12
|
||||||
}
|
}
|
||||||
|
lightning.auto=false
|
||||||
|
|
||||||
|
local thunderactive=false
|
||||||
|
|
||||||
local function do_thunder(start)
|
local function do_thunder(start)
|
||||||
if not start and mcl_weather.current ~= "thunder" then return end
|
if (start and not thunderactive) or mcl_weather.current == "thunder" then
|
||||||
local delay = math.random(mcl_weather.thunder.min_delay, mcl_weather.thunder.max_delay)
|
local delay = math.random(mcl_weather.thunder.min_delay, mcl_weather.thunder.max_delay)
|
||||||
lightning.strike()
|
|
||||||
minetest.after(delay,do_thunder)
|
minetest.after(delay,do_thunder)
|
||||||
|
thunderactive=true
|
||||||
|
else
|
||||||
|
thunderactive=false
|
||||||
|
end
|
||||||
|
minetest.chat_send_all("thunder "..mcl_weather.current)
|
||||||
|
lightning.strike()
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_weather.register_weather("thunder",{
|
mcl_weather.register_weather("thunder",{
|
||||||
|
@ -90,15 +98,13 @@ mcl_weather.register_weather("thunder",{
|
||||||
start = function()
|
start = function()
|
||||||
do_thunder(true)
|
do_thunder(true)
|
||||||
end,
|
end,
|
||||||
start_player = function(name) end,
|
|
||||||
clear = function()
|
clear = function()
|
||||||
mcl_weather.skycolor.remove_layer("lightning")
|
mcl_weather.skycolor.remove_layer("lightning")
|
||||||
end,
|
end,
|
||||||
at_pos = function(pos)
|
at_pos = function(pos)
|
||||||
local biome=minetest.get_biome_data(pos)
|
local biome=minetest.get_biome_data(pos)
|
||||||
if mcl_worlds.has_weather(pos) and biome.heat > 15 and biome.heat < 95 then
|
if not mcl_worlds.has_weather(pos) and biome.heat > 95 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
change_at_pos = "snow"
|
|
||||||
})
|
})
|
Loading…
Reference in New Issue