forked from VoxeLibre/VoxeLibre
update fork #6
|
@ -1,5 +1,5 @@
|
||||||
local PARTICLES_COUNT_RAIN = 100
|
local PARTICLES_COUNT_RAIN = 800
|
||||||
local PARTICLES_COUNT_THUNDER = 300
|
local PARTICLES_COUNT_THUNDER = 1200
|
||||||
|
|
||||||
local get_connected_players = minetest.get_connected_players
|
local get_connected_players = minetest.get_connected_players
|
||||||
|
|
||||||
|
@ -26,38 +26,22 @@ local size = math.random(1,3)
|
||||||
local psdef= {
|
local psdef= {
|
||||||
amount = mcl_weather.rain.particles_count,
|
amount = mcl_weather.rain.particles_count,
|
||||||
time=0,
|
time=0,
|
||||||
minpos = vector.new(-6,3,-6),
|
minpos = vector.new(-15,20,-15),
|
||||||
maxpos = vector.new(6,15,6),
|
maxpos = vector.new(15,25,15),
|
||||||
minvel = vector.new(-vel,-falling_speed,-vel),
|
minvel = vector.new(-2,-falling_speed-2,-2),
|
||||||
maxvel = vector.new(vel,-falling_speed+vel,vel),
|
maxvel = vector.new(2,-falling_speed+2,2),
|
||||||
minacc = vector.new(0,0,0),
|
minacc = vector.new(0,0,0),
|
||||||
maxacc = vector.new(0,-0.4,0),
|
maxacc = vector.new(0,-0.5,0),
|
||||||
minexptime = 0.5,
|
minexptime = 15,
|
||||||
maxexptime = 2,
|
maxexptime = 30,
|
||||||
minsize = size,
|
minsize = size,
|
||||||
maxsize= size*2,
|
maxsize= size*2,
|
||||||
collisiondetection = true,
|
collisiondetection = true,
|
||||||
collision_removal = true,
|
collision_removal = true,
|
||||||
vertical = true,
|
vertical = true,
|
||||||
}
|
}
|
||||||
local psdef_backsplash= {
|
|
||||||
amount = 10,
|
local textures = {"weather_pack_rain_raindrop_1.png", "weather_pack_rain_raindrop_2.png"}
|
||||||
time=0,
|
|
||||||
minpos = vector.new(-3,-1,-3),
|
|
||||||
maxpos = vector.new(3,0,3),
|
|
||||||
minvel = vector.new(-vel,falling_speed*2,-vel),
|
|
||||||
maxvel = vector.new(vel,falling_speed*2+vel,vel),
|
|
||||||
minacc = vector.new(0,0,0),
|
|
||||||
maxacc = vector.new(0,0,0),
|
|
||||||
minexptime = 0.1,
|
|
||||||
maxexptime = 0.2,
|
|
||||||
minsize = size*0.1,
|
|
||||||
maxsize= size*0.5,
|
|
||||||
collisiondetection = true,
|
|
||||||
collision_removal = true,
|
|
||||||
vertical = true,
|
|
||||||
}
|
|
||||||
local textures = {"weather_pack_rain_raindrop_1.png", "weather_pack_rain_raindrop_2.png", "weather_pack_rain_raindrop_1.png"}
|
|
||||||
|
|
||||||
function mcl_weather.rain.sound_handler(player)
|
function mcl_weather.rain.sound_handler(player)
|
||||||
return minetest.sound_play("weather_rain", {
|
return minetest.sound_play("weather_rain", {
|
||||||
|
@ -90,8 +74,6 @@ function mcl_weather.rain.add_rain_particles(player)
|
||||||
psdef.texture=v
|
psdef.texture=v
|
||||||
mcl_weather.add_spawner_player(player,"rain"..k,psdef)
|
mcl_weather.add_spawner_player(player,"rain"..k,psdef)
|
||||||
end
|
end
|
||||||
psdef_backsplash.texture=textures[math.random(1,#textures)]
|
|
||||||
local l=mcl_weather.add_spawner_player(player,"rainbacksplash",psdef_backsplash)
|
|
||||||
if l then
|
if l then
|
||||||
update_sound[player:get_player_name()]=true
|
update_sound[player:get_player_name()]=true
|
||||||
end
|
end
|
||||||
|
@ -185,26 +167,24 @@ function mcl_weather.rain.make_weather()
|
||||||
|
|
||||||
for _, player in pairs(get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
local pos=player:get_pos()
|
local pos=player:get_pos()
|
||||||
if mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(pos) or not mcl_weather.is_outdoor(pos) then
|
if mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(pos) then
|
||||||
mcl_weather.rain.remove_sound(player)
|
mcl_weather.rain.remove_sound(player)
|
||||||
mcl_weather.remove_spawners_player(player)
|
mcl_weather.remove_spawners_player(player)
|
||||||
return false
|
else
|
||||||
end
|
|
||||||
mcl_weather.rain.add_player(player)
|
mcl_weather.rain.add_player(player)
|
||||||
mcl_weather.rain.add_rain_particles(player)
|
mcl_weather.rain.add_rain_particles(player)
|
||||||
mcl_weather.rain.update_sound(player)
|
mcl_weather.rain.update_sound(player)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Switch the number of raindrops: "thunder" for many raindrops, otherwise for normal raindrops
|
-- Switch the number of raindrops: "thunder" for many raindrops, otherwise for normal raindrops
|
||||||
function mcl_weather.rain.set_particles_mode(mode)
|
function mcl_weather.rain.set_particles_mode(mode)
|
||||||
if mode == "thunder" then
|
if mode == "thunder" then
|
||||||
psdef.amount=PARTICLES_COUNT_THUNDER
|
psdef.amount=PARTICLES_COUNT_THUNDER
|
||||||
psdef_backsplash.amount=PARTICLES_COUNT_THUNDER
|
|
||||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_THUNDER
|
mcl_weather.rain.particles_count = PARTICLES_COUNT_THUNDER
|
||||||
else
|
else
|
||||||
psdef.amount=PARTICLES_COUNT_RAIN
|
psdef.amount=PARTICLES_COUNT_RAIN
|
||||||
psdef_backsplash.amount=PARTICLES_COUNT_RAIN
|
|
||||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_RAIN
|
mcl_weather.rain.particles_count = PARTICLES_COUNT_RAIN
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,14 +8,14 @@ mcl_weather.snow.init_done = false
|
||||||
local psdef= {
|
local psdef= {
|
||||||
amount = 99,
|
amount = 99,
|
||||||
time = 0, --stay on til we turn it off
|
time = 0, --stay on til we turn it off
|
||||||
minpos = vector.new(-15,-5,-15),
|
minpos = vector.new(-25,20,-25),
|
||||||
maxpos =vector.new(15,10,15),
|
maxpos =vector.new(25,25,25),
|
||||||
minvel = vector.new(0,-1,0),
|
minvel = vector.new(-0.2,-1,-0.2),
|
||||||
maxvel = vector.new(0,-4,0),
|
maxvel = vector.new(0.2,-4,0.2),
|
||||||
minacc = vector.new(0,-1,0),
|
minacc = vector.new(0,-1,0),
|
||||||
maxacc = vector.new(0,-4,0),
|
maxacc = vector.new(0,-4,0),
|
||||||
minexptime = 1,
|
minexptime = 15,
|
||||||
maxexptime = 1,
|
maxexptime = 30,
|
||||||
minsize = 0.5,
|
minsize = 0.5,
|
||||||
maxsize = 5,
|
maxsize = 5,
|
||||||
collisiondetection = true,
|
collisiondetection = true,
|
||||||
|
@ -70,15 +70,15 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in pairs(get_connected_players()) do
|
for _, player in pairs(get_connected_players()) do
|
||||||
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos()) or not mcl_weather.is_outdoor(player:get_pos())) then
|
if mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos()) then
|
||||||
mcl_weather.remove_spawners_player(player)
|
mcl_weather.remove_spawners_player(player)
|
||||||
return false
|
else
|
||||||
end
|
|
||||||
for i=1,2 do
|
for i=1,2 do
|
||||||
psdef.texture="weather_pack_snow_snowflake"..i..".png"
|
psdef.texture="weather_pack_snow_snowflake"..i..".png"
|
||||||
mcl_weather.add_spawner_player(player,"snow"..i,psdef)
|
mcl_weather.add_spawner_player(player,"snow"..i,psdef)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- register snow weather
|
-- register snow weather
|
||||||
|
|
Loading…
Reference in New Issue