forked from Mineclonia/Mineclonia
Compare commits
11 Commits
master
...
fix-weathe
Author | SHA1 | Date |
---|---|---|
cora | 9db099fe6d | |
cora | 22c49ea605 | |
cora | 85304ae8a3 | |
cora | 4281165c6c | |
cora | d079493056 | |
cora | 62afe49987 | |
cora | 98eb0a1860 | |
cora | a35c5b66cb | |
cora | 9b42b0d5c7 | |
cora | 1adcdc1dbb | |
cora | a78fe52970 |
|
@ -1,36 +1,70 @@
|
||||||
mcl_weather.nether_dust = {}
|
mcl_weather.nether_dust = {}
|
||||||
mcl_weather.nether_dust.particles_count = 99
|
mcl_weather.nether_dust.particlespawners = {}
|
||||||
|
|
||||||
-- calculates coordinates and draw particles for Nether dust
|
local psdef= {
|
||||||
mcl_weather.nether_dust.add_dust_particles = function(player)
|
amount = 99,
|
||||||
for i=mcl_weather.nether_dust.particles_count, 1,-1 do
|
time = 0,
|
||||||
local rpx, rpy, rpz = mcl_weather.get_random_pos_by_player_look_dir(player)
|
minpos = vector.new(-25,0,-25),
|
||||||
minetest.add_particle({
|
maxpos =vector.new(25,15,25),
|
||||||
pos = {x = rpx, y = rpy - math.random(6, 18), z = rpz},
|
minvel = vector.new(-0.3,-0.15,-1),
|
||||||
velocity = {x = math.random(-30,30)*0.01, y = math.random(-15,15)*0.01, z = math.random(-30,30)*0.01},
|
maxvel = vector.new(0.3,0.15,0.3),
|
||||||
acceleration = {x = math.random(-50,50)*0.02, y = math.random(-20,20)*0.02, z = math.random(-50,50)*0.02},
|
minacc = vector.new(-1,-0.4,-1),
|
||||||
expirationtime = 3,
|
maxacc = vector.new(1,0.4,1),
|
||||||
size = math.random(6,20)*0.01,
|
minexptime = 1,
|
||||||
collisiondetection = false,
|
maxexptime = 1,
|
||||||
object_collision = false,
|
minsize = mins,
|
||||||
vertical = false,
|
maxsize = maxs,
|
||||||
glow = math.random(0,minetest.LIGHT_MAX),
|
collisiondetection = false,
|
||||||
texture = "mcl_particles_nether_dust"..tostring(i%3+1)..".png",
|
collision_removal = false,
|
||||||
playername = player:get_player_name()
|
object_collision = false,
|
||||||
})
|
vertical = false,
|
||||||
|
glow = math.random(0,minetest.LIGHT_MAX)
|
||||||
|
}
|
||||||
|
|
||||||
|
local function check_player(player)
|
||||||
|
local name=player:get_player_name(name)
|
||||||
|
if mcl_worlds.has_dust(player:get_pos()) and not mcl_weather.nether_dust.particlespawners[name] then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.nether_dust.add_particlespawners = function(player)
|
||||||
|
if not check_player(player) then return end
|
||||||
|
local name=player:get_player_name(name)
|
||||||
|
mcl_weather.nether_dust.particlespawners[name]={}
|
||||||
|
psdef.playername = name
|
||||||
|
psdef.attached = player
|
||||||
|
for i=1,3 do
|
||||||
|
psdef.texture="mcl_particles_nether_dust"..i..".png"
|
||||||
|
mcl_weather.nether_dust.particlespawners[name][i]=minetest.add_particlespawner(psdef)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = 0
|
mcl_weather.nether_dust.delete_particlespawners = function(player)
|
||||||
minetest.register_globalstep(function(dtime)
|
local name=player:get_player_name(name)
|
||||||
timer = timer + dtime
|
if mcl_weather.nether_dust.particlespawners[name] then
|
||||||
if timer < 0.7 then return end
|
for i=1,3 do
|
||||||
timer = 0
|
minetest.delete_particlespawner(mcl_weather.nether_dust.particlespawners[name][i])
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
|
||||||
if not mcl_worlds.has_dust(player:get_pos()) then
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
mcl_weather.nether_dust.add_dust_particles(player)
|
mcl_weather.nether_dust.particlespawners[name]=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_worlds.register_on_dimension_change(function(player, dimension)
|
||||||
|
if dimension == "nether" then
|
||||||
|
if check_player(player) then
|
||||||
|
mcl_weather.nether_dust.add_particlespawners(player)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
mcl_weather.nether_dust.delete_particlespawners(player)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
if check_player(player) then
|
||||||
|
mcl_weather.nether_dust.add_particlespawners(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
mcl_weather.nether_dust.delete_particlespawners(player)
|
||||||
|
end)
|
|
@ -1,5 +1,7 @@
|
||||||
local PARTICLES_COUNT_RAIN = 30
|
local PARTICLES_COUNT_RAIN = 800
|
||||||
local PARTICLES_COUNT_THUNDER = 45
|
local PARTICLES_COUNT_THUNDER = 1200
|
||||||
|
local PARTICLES_SPEED_RAIN = 10
|
||||||
|
local PARTICLES_SPEED_THUNDER = 15
|
||||||
|
|
||||||
mcl_weather.rain = {
|
mcl_weather.rain = {
|
||||||
-- max rain particles created at time
|
-- max rain particles created at time
|
||||||
|
@ -8,6 +10,9 @@ mcl_weather.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,
|
||||||
|
|
||||||
|
-- falling speed of the raindrops
|
||||||
|
falling_speed = PARTICLES_SPEED_RAIN,
|
||||||
|
|
||||||
-- flag useful when mixing weathers
|
-- flag useful when mixing weathers
|
||||||
raining = false,
|
raining = false,
|
||||||
|
|
||||||
|
@ -16,6 +21,8 @@ mcl_weather.rain = {
|
||||||
sky_last_update = -1,
|
sky_last_update = -1,
|
||||||
|
|
||||||
init_done = false,
|
init_done = false,
|
||||||
|
|
||||||
|
ps = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcl_weather.rain.sound_handler = function(player)
|
mcl_weather.rain.sound_handler = function(player)
|
||||||
|
@ -42,29 +49,55 @@ mcl_weather.rain.set_sky_box = function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- creating manually parctiles instead of particles spawner because of easier to control
|
-- ~~creating manually parctiles instead of particles spawner because of easier to control spawn position~~.
|
||||||
-- spawn position.
|
-- why, mcl2, WHY???
|
||||||
mcl_weather.rain.add_rain_particles = function(player)
|
-- use particle spawner to not send .. you know hundreds of packets per second for each f*ing rain particle
|
||||||
|
local function get_spawnerdef(dtype)
|
||||||
|
local textures = {"weather_pack_rain_raindrop_1.png", "weather_pack_rain_raindrop_2.png", "weather_pack_rain_raindrop_1.png"}
|
||||||
|
local rt = {
|
||||||
|
amount = 800,
|
||||||
|
time = 0,
|
||||||
|
minpos = vector.new(-15,5,-15),
|
||||||
|
maxpos = vector.new(15,10,15),
|
||||||
|
minvel = vector.new(0, -5,0),
|
||||||
|
maxvel = vector.new(0,-15,0),
|
||||||
|
minacc = vector.new(0,-10,0),
|
||||||
|
maxacc = vector.new(0,-30,0),
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 1,
|
||||||
|
minsize = 0.5,
|
||||||
|
maxsize = 5,
|
||||||
|
collisiondetection = true,
|
||||||
|
collision_removal = true,
|
||||||
|
object_collision = true,
|
||||||
|
vertical = true,
|
||||||
|
texture = mcl_weather.rain.get_texture(),
|
||||||
|
-- animation = {Tile Animation definition},
|
||||||
|
glow = 0
|
||||||
|
-- node = {name = "ignore", param2 = 0},
|
||||||
|
--node_tile = 0,
|
||||||
|
}
|
||||||
|
return rt
|
||||||
|
end
|
||||||
|
mcl_weather.rain.add_rain_particlespawner = function(name,def)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if not player then return end
|
||||||
|
|
||||||
mcl_weather.rain.last_rp_count = 0
|
mcl_weather.rain.last_rp_count = 0
|
||||||
for i=mcl_weather.rain.particles_count, 1,-1 do
|
for i=mcl_weather.rain.particles_count, 1,-1 do
|
||||||
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
|
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
|
||||||
if mcl_weather.is_outdoor({x=random_pos_x, y=random_pos_y, z=random_pos_z}) then
|
if mcl_weather.is_outdoor({x=random_pos_x, y=random_pos_y, z=random_pos_z}) then
|
||||||
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
|
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
|
||||||
minetest.add_particle({
|
|
||||||
pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z},
|
|
||||||
velocity = {x=0, y=-10, z=0},
|
|
||||||
acceleration = {x=0, y=-30, z=0},
|
|
||||||
expirationtime = 1.0,
|
|
||||||
size = math.random(0.5, 3),
|
|
||||||
collisiondetection = true,
|
|
||||||
collision_removal = true,
|
|
||||||
vertical = true,
|
|
||||||
texture = mcl_weather.rain.get_texture(),
|
|
||||||
playername = player:get_player_name()
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local name=player:get_player_name()
|
||||||
|
if mcl_weather.is_outdoor(player:get_pos()) then
|
||||||
|
if mcl_weather.state ~= "thunder" then def.amount=PARTICLES_COUNT_THUNDER end
|
||||||
|
def.player = name
|
||||||
|
def.attached = player
|
||||||
|
mcl_weather.rain.ps[name] = minetest.add_particlespawner(def)
|
||||||
|
end
|
||||||
|
mcl_weather.rain.init_done = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Simple random texture getter
|
-- Simple random texture getter
|
||||||
|
@ -88,15 +121,33 @@ mcl_weather.rain.add_player = function(player)
|
||||||
local player_meta = {}
|
local player_meta = {}
|
||||||
player_meta.origin_sky = {player:get_sky()}
|
player_meta.origin_sky = {player:get_sky()}
|
||||||
mcl_weather.players[player:get_player_name()] = player_meta
|
mcl_weather.players[player:get_player_name()] = player_meta
|
||||||
|
mcl_weather.rain.add_rain_particlespawner(player:get_player_name(),get_spawnerdef("rain"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
if mcl_weather.rain.raining then
|
||||||
|
mcl_weather.rain.add_player(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
if mcl_weather.rain.raining then
|
||||||
|
mcl_weather.rain.remove_player(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
-- remove player from player list effected by rain.
|
-- remove player from player list effected by rain.
|
||||||
-- be sure to remove sound before removing player otherwise soundhandler reference will be lost.
|
-- be sure to remove sound before removing player otherwise soundhandler reference will be lost.
|
||||||
mcl_weather.rain.remove_player = function(player)
|
mcl_weather.rain.remove_player = function(player)
|
||||||
local player_meta = mcl_weather.players[player:get_player_name()]
|
local name = player:get_player_name()
|
||||||
|
local player_meta = mcl_weather.players[name]
|
||||||
|
local ps = mcl_weather.rain.ps[name]
|
||||||
|
if ps then
|
||||||
|
minetest.delete_particlespawner(ps,name)
|
||||||
|
end
|
||||||
|
mcl_weather.rain.ps[name]=nil
|
||||||
if player_meta ~= nil and player_meta.origin_sky ~= nil then
|
if player_meta ~= nil and player_meta.origin_sky ~= nil then
|
||||||
player:set_clouds({color="#FFF0F0E5"})
|
player:set_clouds({color="#FFF0F0E5"})
|
||||||
|
mcl_weather.rain.remove_sound(player)
|
||||||
mcl_weather.players[player:get_player_name()] = nil
|
mcl_weather.players[player:get_player_name()] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -155,7 +206,6 @@ mcl_weather.rain.clear = function()
|
||||||
mcl_weather.rain.set_particles_mode("rain")
|
mcl_weather.rain.set_particles_mode("rain")
|
||||||
mcl_weather.skycolor.remove_layer("weather-pack-rain-sky")
|
mcl_weather.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
|
||||||
mcl_weather.rain.remove_sound(player)
|
|
||||||
mcl_weather.rain.remove_player(player)
|
mcl_weather.rain.remove_player(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -173,16 +223,16 @@ mcl_weather.rain.make_weather = function()
|
||||||
mcl_weather.rain.raining = true
|
mcl_weather.rain.raining = true
|
||||||
mcl_weather.rain.set_sky_box()
|
mcl_weather.rain.set_sky_box()
|
||||||
mcl_weather.rain.set_particles_mode(mcl_weather.mode)
|
mcl_weather.rain.set_particles_mode(mcl_weather.mode)
|
||||||
mcl_weather.rain.init_done = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
if mcl_weather.players[player:get_player_name()] == nil then
|
||||||
|
mcl_weather.rain.add_player(player)
|
||||||
|
end
|
||||||
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
||||||
mcl_weather.rain.remove_sound(player)
|
mcl_weather.rain.remove_sound(player)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
mcl_weather.rain.add_player(player)
|
|
||||||
mcl_weather.rain.add_rain_particles(player)
|
|
||||||
mcl_weather.rain.update_sound(player)
|
mcl_weather.rain.update_sound(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -191,8 +241,10 @@ end
|
||||||
mcl_weather.rain.set_particles_mode = function(mode)
|
mcl_weather.rain.set_particles_mode = function(mode)
|
||||||
if mode == "thunder" then
|
if mode == "thunder" then
|
||||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_THUNDER
|
mcl_weather.rain.particles_count = PARTICLES_COUNT_THUNDER
|
||||||
|
mcl_weather.rain.falling_speed = PARTICLES_SPEED_THUNDER
|
||||||
else
|
else
|
||||||
mcl_weather.rain.particles_count = PARTICLES_COUNT_RAIN
|
mcl_weather.rain.particles_count = PARTICLES_COUNT_RAIN
|
||||||
|
mcl_weather.rain.falling_speed = PARTICLES_SPEED_RAIN
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,58 @@
|
||||||
mcl_weather.snow = {}
|
mcl_weather.snow = {}
|
||||||
|
mcl_weather.snow.particlespawners = {}
|
||||||
|
|
||||||
mcl_weather.snow.particles_count = 15
|
local psdef= {
|
||||||
mcl_weather.snow.init_done = false
|
amount = 30,
|
||||||
|
time = 0,
|
||||||
|
minpos = vector.new(-15,5,-15),
|
||||||
|
maxpos =vector.new(15,10,15),
|
||||||
|
minvel = vector.new(0,-1,0),
|
||||||
|
maxvel = vector.new(0,-4,0),
|
||||||
|
minacc = vector.new(0,-1,0),
|
||||||
|
maxacc = vector.new(0,-4,0),
|
||||||
|
minexptime = 1,
|
||||||
|
maxexptime = 1,
|
||||||
|
minsize = 0.5,
|
||||||
|
maxsize = 5,
|
||||||
|
collisiondetection = true,
|
||||||
|
collision_removal = true,
|
||||||
|
object_collision = true,
|
||||||
|
vertical = true,
|
||||||
|
glow = 1
|
||||||
|
}
|
||||||
|
|
||||||
-- calculates coordinates and draw particles for snow weather
|
local function check_player(player)
|
||||||
mcl_weather.snow.add_snow_particles = function(player)
|
if mcl_weather.state ~= "snow" then return false end
|
||||||
mcl_weather.rain.last_rp_count = 0
|
local name=player:get_player_name(name)
|
||||||
for i=mcl_weather.snow.particles_count, 1,-1 do
|
if mcl_worlds.has_weather(player:get_pos()) and not mcl_weather.snow.particlespawners[name] then
|
||||||
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
|
return true
|
||||||
random_pos_y = math.random() + math.random(player:get_pos().y - 1, player:get_pos().y + 7)
|
end
|
||||||
if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then
|
return false
|
||||||
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
|
end
|
||||||
minetest.add_particle({
|
|
||||||
pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z},
|
mcl_weather.snow.add_particlespawners = function(player)
|
||||||
velocity = {x = math.random(-100,100)*0.001, y = math.random(-300,-100)*0.004, z = math.random(-100,100)*0.001},
|
if not check_player(player) then
|
||||||
acceleration = {x = 0, y=0, z = 0},
|
mcl_weather.snow.delete_particlespawners(player)
|
||||||
expirationtime = 8.0,
|
return
|
||||||
size = 1,
|
|
||||||
collisiondetection = true,
|
|
||||||
collision_removal = true,
|
|
||||||
object_collision = false,
|
|
||||||
vertical = false,
|
|
||||||
texture = mcl_weather.snow.get_texture(),
|
|
||||||
playername = player:get_player_name()
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
local name=player:get_player_name(name)
|
||||||
|
mcl_weather.snow.particlespawners[name]={}
|
||||||
|
psdef.playername = name
|
||||||
|
psdef.attached = player
|
||||||
|
for i=1,2 do
|
||||||
|
psdef.texture="weather_pack_snow_snowflake"..i..".png"
|
||||||
|
mcl_weather.snow.particlespawners[name][i]=minetest.add_particlespawner(psdef)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.snow.delete_particlespawners = function(player)
|
||||||
|
local name=player:get_player_name(name)
|
||||||
|
if mcl_weather.snow.particlespawners[name] then
|
||||||
|
for i=1,2 do
|
||||||
|
minetest.delete_particlespawner(mcl_weather.snow.particlespawners[name][i])
|
||||||
|
end
|
||||||
|
mcl_weather.snow.particlespawners[name]=nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_weather.snow.set_sky_box = function()
|
mcl_weather.snow.set_sky_box = function()
|
||||||
|
@ -38,47 +65,70 @@ mcl_weather.snow.set_sky_box = function()
|
||||||
{r=0, g=0, b=0}})
|
{r=0, g=0, b=0}})
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
player:set_clouds({color="#ADADADE8"})
|
|
||||||
end
|
end
|
||||||
mcl_weather.skycolor.active = true
|
mcl_weather.skycolor.active = true
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_weather.snow.clear = function()
|
|
||||||
|
mcl_weather.snow.start_player = function(player)
|
||||||
|
if check_player(player) then
|
||||||
|
mcl_weather.snow.add_particlespawners(player)
|
||||||
|
player:set_clouds({color="#ADADADE8"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.snow.clear_player = function(player)
|
||||||
|
mcl_weather.snow.delete_particlespawners(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.snow.start = function()
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
mcl_weather.snow.start_player(player)
|
||||||
|
end
|
||||||
|
mcl_weather.snow.set_sky_box()
|
||||||
|
mcl_weather.snow.init_done = true
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_weather.snow.clear = function()
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
mcl_weather.snow.clear_player(player)
|
||||||
|
end
|
||||||
mcl_weather.skycolor.remove_layer("weather-pack-snow-sky")
|
mcl_weather.skycolor.remove_layer("weather-pack-snow-sky")
|
||||||
mcl_weather.snow.init_done = false
|
mcl_weather.snow.init_done = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Simple random texture getter
|
|
||||||
mcl_weather.snow.get_texture = function()
|
|
||||||
return "weather_pack_snow_snowflake"..math.random(1,2)..".png"
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
if mcl_weather.state ~= "snow" then
|
if mcl_weather.state ~= "snow" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
timer = timer + dtime;
|
|
||||||
if timer >= 0.5 then
|
|
||||||
timer = 0
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if mcl_weather.snow.init_done == false then
|
if mcl_weather.rain.init_done == false then
|
||||||
mcl_weather.snow.set_sky_box()
|
mcl_weather.snow.start()
|
||||||
mcl_weather.snow.init_done = true
|
mcl_weather.rain.set_sky_box()
|
||||||
end
|
mcl_weather.rain.set_particles_mode(mcl_weather.mode)
|
||||||
|
elseif mcl_weather.state ~= "snow" then
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
mcl_weather.snow.clear()
|
||||||
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
|
end
|
||||||
return false
|
|
||||||
end
|
|
||||||
mcl_weather.snow.add_snow_particles(player)
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
mcl_weather.snow.start_player(player)
|
||||||
|
end)
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
mcl_weather.snow.clear_player(player)
|
||||||
|
end)
|
||||||
|
|
||||||
|
mcl_worlds.register_on_dimension_change(function(player, dimension)
|
||||||
|
if dimension == "overworld" then
|
||||||
|
mcl_weather.snow.add_particlespawners(player)
|
||||||
|
else
|
||||||
|
mcl_weather.snow.delete_particlespawners(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- register snow weather
|
-- register snow weather
|
||||||
if mcl_weather.reg_weathers.snow == nil then
|
if mcl_weather.reg_weathers.snow == nil then
|
||||||
mcl_weather.reg_weathers.snow = {
|
mcl_weather.reg_weathers.snow = {
|
||||||
|
|
Loading…
Reference in New Issue