+ nether_cool_off_timer = 6 --if you read this, you'll notice the nether cool off timer is 6 and this is 7 ;)
+ minetest.after(1,function()
+ local after_newpos = minetest.localplayer:get_pos().y
+ if after_newpos < -10000 and after_newpos > -20000 then
+ --cancel old songs
+ if current_song then
+ minetest.sound_fade(current_song,-0.4,0)
+ end
+
+ minetest.after(math.random(3,5)+math.random(),function()
+ if after_newpos < -10000 and after_newpos > -20000 then
+ --backup in case server lags out
+ if current_song then
+ minetest.sound_fade(current_song,-0.4,0)
+ end
+ local song = 90000+math.random(0,1)
+ --print(song)
+ song_playing = song_table[song].name
+ current_song = minetest.sound_play(song_table[song].name,{gain=song_volume})
+ song_index = song
+
+ end
+ end)
+ elseif song_playing and (song_index == 90000 or song_index == 90001) then
+ minetest.sound_fade(current_song,-0.4,0)
+ song_playing = nil
+ song_index = nil
+ song_tick = 0
+ end
+ end)