forked from Mineclonia/Mineclonia
add different falling speeds for rain and thunder
This commit is contained in:
parent
a78fe52970
commit
1adcdc1dbb
|
@ -1,5 +1,7 @@
|
|||
local PARTICLES_COUNT_RAIN = 30
|
||||
local PARTICLES_COUNT_THUNDER = 45
|
||||
local PARTICLES_COUNT_RAIN = 800
|
||||
local PARTICLES_COUNT_THUNDER = 1200
|
||||
local PARTICLES_SPEED_RAIN = 10
|
||||
local PARTICLES_SPEED_THUNDER = 15
|
||||
|
||||
mcl_weather.rain = {
|
||||
-- max rain particles created at time
|
||||
|
@ -8,6 +10,9 @@ mcl_weather.rain = {
|
|||
-- flag to turn on/off extinguish fire for rain
|
||||
extinguish_fire = true,
|
||||
|
||||
-- falling speed of the raindrops
|
||||
falling_speed = PARTICLES_SPEED_RAIN,
|
||||
|
||||
-- flag useful when mixing weathers
|
||||
raining = false,
|
||||
|
||||
|
@ -51,25 +56,23 @@ mcl_weather.rain.add_rain_particlespawner = function(name)
|
|||
if not player then return end
|
||||
|
||||
if mcl_weather.rain.raining then
|
||||
minetest.after(1,mcl_weather.rain.add_rain_particlespawner,name)
|
||||
minetest.after(0.8,mcl_weather.rain.add_rain_particlespawner,name)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local wind=vector.new(math.random(0,3),0,math.random(0,3))
|
||||
local falling_speed = math.random(10,15)
|
||||
local amount = math.random(200,400)
|
||||
local size = math.random(2,5)
|
||||
local wind=vector.new(0,0,0)
|
||||
local size = math.random(0.5, 5)
|
||||
local texture = {"weather_pack_rain_raindrop_1.png", "weather_pack_rain_raindrop_2.png", "weather_pack_rain_raindrop_1.png"}
|
||||
|
||||
local player_pos = player:get_pos()
|
||||
local wind_pos = vector.multiply(wind, -1)
|
||||
local minpos = {x = -15, y = 10, z = -15}
|
||||
local maxpos = {x = 15, y = 10, z = 15}
|
||||
local minpos = {x = -25, y = 5, z = -25}
|
||||
local maxpos = {x = 25, y = 15, z = 25}
|
||||
local wind_pos=vector.new(0,0,0)
|
||||
local minp = vector.add(vector.add(player_pos, minpos), wind_pos)
|
||||
local maxp = vector.add(vector.add(player_pos, maxpos), wind_pos)
|
||||
local vel = {x = wind.x, y = - falling_speed, z = wind.z}
|
||||
local acc = {x = 0, y = 0, z = 0}
|
||||
local vel = {x = wind.x, y = - mcl_weather.rain.falling_speed, z = wind.z}
|
||||
local acc = {x = 0, y = -30, z = 0}
|
||||
local exp = 1
|
||||
|
||||
if type(texture) == "table" then
|
||||
|
@ -225,8 +228,10 @@ end
|
|||
mcl_weather.rain.set_particles_mode = function(mode)
|
||||
if mode == "thunder" then
|
||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_THUNDER
|
||||
mcl_weather.rain.falling_speed = PARTICLES_SPEED_THUNDER
|
||||
else
|
||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_RAIN
|
||||
mcl_weather.rain.falling_speed = PARTICLES_SPEED_RAIN
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue