forked from MineClone5/MineClone5
add simple weather particlespawner manager
This commit is contained in:
parent
d968ceb209
commit
cbe9f72526
|
@ -47,6 +47,29 @@ local function save_weather()
|
||||||
end
|
end
|
||||||
minetest.register_on_shutdown(save_weather)
|
minetest.register_on_shutdown(save_weather)
|
||||||
|
|
||||||
|
local particlespawners={}
|
||||||
|
function mcl_weather.add_spawner_player(pl,id,ps)
|
||||||
|
local name=pl:get_player_name()
|
||||||
|
if not particlespawners[name] then
|
||||||
|
particlespawners[name] = {}
|
||||||
|
end
|
||||||
|
if not particlespawners[name][id] then
|
||||||
|
ps.playername =name
|
||||||
|
ps.attached = pl
|
||||||
|
particlespawners[name][id]=minetest.add_particlespawner(ps)
|
||||||
|
return particlespawners[name][id]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function mcl_weather.remove_spawners_player(pl)
|
||||||
|
local name=pl:get_player_name()
|
||||||
|
if not particlespawners[name] then return end
|
||||||
|
for k,v in pairs(particlespawners[name]) do
|
||||||
|
minetest.delete_particlespawner(v)
|
||||||
|
end
|
||||||
|
particlespawners[name] = nil
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
function mcl_weather.get_rand_end_time(min_duration, max_duration)
|
function mcl_weather.get_rand_end_time(min_duration, max_duration)
|
||||||
local r
|
local r
|
||||||
if min_duration and max_duration then
|
if min_duration and max_duration then
|
||||||
|
|
Loading…
Reference in New Issue