Import mods: lightning and weather_pack
lightning by sofar weather_pack by xeranas
This commit is contained in:
parent
1f3d14e0b0
commit
45e45e9c66
29 changed files with 953 additions and 0 deletions
37
mods/MISC/weather_pack/thunder.lua
Normal file
37
mods/MISC/weather_pack/thunder.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
-- turn off lightning mod 'auto mode'
|
||||
lightning.auto = false
|
||||
|
||||
thunder = {
|
||||
next_strike = 0,
|
||||
min_delay = 3,
|
||||
max_delay = 12,
|
||||
}
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if weather.state ~= "thunder" then
|
||||
return false
|
||||
end
|
||||
|
||||
rain.make_weather()
|
||||
|
||||
if (thunder.next_strike <= os.time()) then
|
||||
lightning.strike()
|
||||
local delay = math.random(thunder.min_delay, thunder.max_delay)
|
||||
thunder.next_strike = os.time() + delay
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
thunder.clear = function()
|
||||
rain.clear()
|
||||
end
|
||||
|
||||
-- register thunderstorm weather
|
||||
if weather.reg_weathers.thunder == nil then
|
||||
weather.reg_weathers.thunder = {
|
||||
chance = 5,
|
||||
clear = thunder.clear,
|
||||
min_duration = 120,
|
||||
max_duration = 600,
|
||||
}
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue