1
0
Fork 0

Generate more raindrops in thunderstorms

objects
Wuzzy 2017-11-12 01:52:07 +01:00
parent de45af5e79
commit b3ad5c7927
2 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,9 @@
local PARTICLES_COUNT_RAIN = 30
local PARTICLES_COUNT_THUNDER = 60
rain = { rain = {
-- max rain particles created at time -- max rain particles created at time
particles_count = 35, particles_count = PARTICLES_COUNT_RAIN,
-- flag to turn on/off extinguish fire for rain -- flag to turn on/off extinguish fire for rain
extinguish_fire = true, extinguish_fire = true,
@ -137,6 +140,7 @@ rain.clear = function()
rain.raining = false rain.raining = false
rain.sky_last_update = -1 rain.sky_last_update = -1
rain.init_done = false rain.init_done = false
rain.set_particles_mode("rain")
skycolor.remove_layer("weather-pack-rain-sky") skycolor.remove_layer("weather-pack-rain-sky")
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
rain.remove_sound(player) rain.remove_sound(player)
@ -157,6 +161,7 @@ rain.make_weather = function()
rain.raining = true rain.raining = true
rain.set_sky_box() rain.set_sky_box()
rain.init_done = true rain.init_done = true
rain.set_particles_mode(weather.mode)
end end
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
@ -177,6 +182,15 @@ if weather.reg_weathers.rain == nil then
} }
end end
-- Switch the number of raindrops: "thunder" for many raindrops, otherwise for normal raindrops
rain.set_particles_mode = function(mode)
if mode == "thunder" then
rain.particles_count = PARTICLES_COUNT_THUNDER
else
rain.particles_count = PARTICLES_COUNT_RAIN
end
end
if weather.allow_abm then if weather.allow_abm then
-- ABM for extinguish fire -- ABM for extinguish fire
minetest.register_abm({ minetest.register_abm({

View File

@ -13,6 +13,7 @@ minetest.register_globalstep(function(dtime)
return false return false
end end
rain.set_particles_mode("thunder")
rain.make_weather() rain.make_weather()
if thunder.init_done == false then if thunder.init_done == false then