1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

[ambience] Use minetest.after

This commit is contained in:
Wouters Dorian 2015-07-31 15:11:31 +02:00
parent 1d5b2aac23
commit ca056b9920

View File

@ -738,14 +738,8 @@ local stop_sound = function(still_playing, player)
end end
local timer = 0 local function tick()
minetest.register_globalstep(function(dtime) minetest.after(1, tick)
timer = timer+dtime
if timer < 1 then
return
end
timer = 0
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
ambiences = get_ambience(player) ambiences = get_ambience(player)
stop_sound(ambiences, player) stop_sound(ambiences, player)
@ -773,8 +767,9 @@ minetest.register_globalstep(function(dtime)
end end
end end
end end
end) end
tick()
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()