From b3ad5c7927aebb9390cad5f3a44111709e4fc6c0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 12 Nov 2017 01:52:07 +0100 Subject: [PATCH] Generate more raindrops in thunderstorms --- mods/ENVIRONMENT/weather_pack/rain.lua | 16 +++++++++++++++- mods/ENVIRONMENT/weather_pack/thunder.lua | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/weather_pack/rain.lua b/mods/ENVIRONMENT/weather_pack/rain.lua index 63e3467990..b76042a6bb 100644 --- a/mods/ENVIRONMENT/weather_pack/rain.lua +++ b/mods/ENVIRONMENT/weather_pack/rain.lua @@ -1,6 +1,9 @@ +local PARTICLES_COUNT_RAIN = 30 +local PARTICLES_COUNT_THUNDER = 60 + rain = { -- max rain particles created at time - particles_count = 35, + particles_count = PARTICLES_COUNT_RAIN, -- flag to turn on/off extinguish fire for rain extinguish_fire = true, @@ -137,6 +140,7 @@ rain.clear = function() rain.raining = false rain.sky_last_update = -1 rain.init_done = false + rain.set_particles_mode("rain") skycolor.remove_layer("weather-pack-rain-sky") for _, player in ipairs(minetest.get_connected_players()) do rain.remove_sound(player) @@ -157,6 +161,7 @@ rain.make_weather = function() rain.raining = true rain.set_sky_box() rain.init_done = true + rain.set_particles_mode(weather.mode) end for _, player in ipairs(minetest.get_connected_players()) do @@ -177,6 +182,15 @@ if weather.reg_weathers.rain == nil then } 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 -- ABM for extinguish fire minetest.register_abm({ diff --git a/mods/ENVIRONMENT/weather_pack/thunder.lua b/mods/ENVIRONMENT/weather_pack/thunder.lua index 7b87bb2be9..91ce34df8d 100644 --- a/mods/ENVIRONMENT/weather_pack/thunder.lua +++ b/mods/ENVIRONMENT/weather_pack/thunder.lua @@ -13,6 +13,7 @@ minetest.register_globalstep(function(dtime) return false end + rain.set_particles_mode("thunder") rain.make_weather() if thunder.init_done == false then