rawset lightning global
This commit is contained in:
parent
67dd90eb17
commit
362bef381a
|
@ -62,14 +62,14 @@ function weather_mod.register_downfall(id,def)
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("lightning") then
|
if minetest.get_modpath("lightning") then
|
||||||
lightning.auto = false
|
rawset(lightning,"auto",false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function weather_mod.handle_lightning()
|
function weather_mod.handle_lightning()
|
||||||
if not minetest.get_modpath("lightning") then return end
|
if not minetest.get_modpath("lightning") then return end
|
||||||
local current_downfall = weather_mod.registered_downfalls[weather.type]
|
local current_downfall = weather_mod.registered_downfalls[weather.type]
|
||||||
if not current_downfall then return end
|
if not current_downfall then return end
|
||||||
lightning.auto = current_downfall.enable_lightning
|
rawset(lightning,"auto",current_downfall.enable_lightning)
|
||||||
if current_downfall.enable_lightning and math.random(1,2) == 1 then
|
if current_downfall.enable_lightning and math.random(1,2) == 1 then
|
||||||
local time = math.floor(math.random(lightning.interval_low/2,lightning.interval_low))
|
local time = math.floor(math.random(lightning.interval_low/2,lightning.interval_low))
|
||||||
minetest.after(time, lightning.strike)
|
minetest.after(time, lightning.strike)
|
||||||
|
@ -92,7 +92,7 @@ minetest.register_globalstep(function()
|
||||||
if math.random(1, 10000) == 1 then
|
if math.random(1, 10000) == 1 then
|
||||||
weather.type = "none"
|
weather.type = "none"
|
||||||
if minetest.get_modpath("lightning") then
|
if minetest.get_modpath("lightning") then
|
||||||
lightning.auto = false
|
rawset(lightning,"auto",false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue