Created
September 14, 2012 15:22
-
-
Save PilzAdam/3722598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if minetest.setting_getbool("313hummer_fan") and minetest.setting_get("music_frequency") and tonumber(minetest.setting_get("music_frequency")) then | |
local music = { | |
{name="313hummer_music_echos", length=26+2*60}, | |
{name="313hummer_music_", length=0}, | |
{name="313hummer_music_", length=0}, | |
{name="313hummer_music_", length=0}, | |
{name="313hummer_music_", length=0}, | |
{name="313hummer_music_", length=0}, | |
{name="313hummer_music_", length=0}, | |
} | |
local time = 0 | |
local playing = false | |
minetest.register_globalstep(function(dtime) | |
if playing then | |
return | |
end | |
time = time+dtime | |
if time < 10 then | |
return | |
end | |
time = 0 | |
if math.random(1, 100) <= tonumber(minetest.setting_get("music_frequency")) then | |
local track = music[math.random(1, #music)] | |
minetest.sound_play(track.name) | |
playing = true | |
minetest.after(track.length, function() | |
playing = false | |
end) | |
end | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment