2020-10-24 20:49:11 +03:00
|
|
|
mcl_weather.nether_dust = {}
|
2021-09-25 03:06:39 +03:00
|
|
|
mcl_weather.nether_dust.particlespawners = {}
|
2020-10-24 20:49:11 +03:00
|
|
|
|
2021-09-25 03:06:39 +03:00
|
|
|
local psdef= {
|
|
|
|
amount = 150,
|
|
|
|
time = 0,
|
|
|
|
minpos = vector.new(-15,-15,-15),
|
|
|
|
maxpos =vector.new(15,15,15),
|
|
|
|
minvel = vector.new(-0.3,-0.15,-1),
|
|
|
|
maxvel = vector.new(0.3,0.15,0.3),
|
|
|
|
minacc = vector.new(-1,-0.4,-1),
|
|
|
|
maxacc = vector.new(1,0.4,1),
|
|
|
|
minexptime = 1,
|
|
|
|
maxexptime = 10,
|
|
|
|
minsize = 0.2,
|
|
|
|
maxsize = 0.7,
|
|
|
|
collisiondetection = false,
|
|
|
|
collision_removal = false,
|
|
|
|
object_collision = false,
|
|
|
|
vertical = false
|
|
|
|
}
|
|
|
|
|
|
|
|
local function check_player(player)
|
|
|
|
local name=player:get_player_name()
|
|
|
|
if mcl_worlds.has_dust(player:get_pos()) and not mcl_weather.nether_dust.particlespawners[name] then
|
|
|
|
return true
|
|
|
|
end
|
2020-10-24 20:49:11 +03:00
|
|
|
end
|
|
|
|
|
2021-09-25 03:06:39 +03:00
|
|
|
mcl_weather.nether_dust.add_particlespawners = function(player)
|
2022-05-02 22:47:33 +03:00
|
|
|
local name=player:get_player_name()
|
2021-09-25 03:06:39 +03:00
|
|
|
mcl_weather.nether_dust.particlespawners[name]={}
|
|
|
|
psdef.playername = name
|
|
|
|
psdef.attached = player
|
|
|
|
psdef.glow = math.random(0,minetest.LIGHT_MAX)
|
|
|
|
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
|
2020-10-24 20:49:11 +03:00
|
|
|
|
2021-09-25 03:06:39 +03:00
|
|
|
mcl_weather.nether_dust.delete_particlespawners = function(player)
|
2022-05-09 13:06:28 +03:00
|
|
|
local name=player:get_player_name()
|
2021-09-25 03:06:39 +03:00
|
|
|
if mcl_weather.nether_dust.particlespawners[name] then
|
|
|
|
for i=1,3 do
|
|
|
|
minetest.delete_particlespawner(mcl_weather.nether_dust.particlespawners[name][i])
|
2020-10-24 20:49:11 +03:00
|
|
|
end
|
2021-09-25 03:06:39 +03:00
|
|
|
mcl_weather.nether_dust.particlespawners[name]=nil
|
2020-10-24 20:49:11 +03:00
|
|
|
end
|
2021-09-25 03:06:39 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
mcl_worlds.register_on_dimension_change(function(player, dimension)
|
|
|
|
if check_player(player) then
|
|
|
|
return mcl_weather.nether_dust.add_particlespawners(player)
|
|
|
|
end
|
|
|
|
mcl_weather.nether_dust.delete_particlespawners(player)
|
|
|
|
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)
|
2020-10-24 20:49:11 +03:00
|
|
|
end)
|