2012-08-17 23:10:53 +02:00
|
|
|
math.randomseed(3)
|
|
|
|
sound_playing = 0
|
2012-08-17 16:36:04 +02:00
|
|
|
|
2012-08-17 23:10:53 +02:00
|
|
|
minetest.register_globalstep(function(time)
|
|
|
|
local time = minetest.env:get_timeofday()
|
|
|
|
-- minetest.chat_send_all(time .. " " .. sound_playing)
|
2012-08-17 16:36:04 +02:00
|
|
|
|
2012-08-17 23:10:53 +02:00
|
|
|
if sound_playing == 0 then
|
|
|
|
sound_playing = time
|
|
|
|
end
|
2012-08-17 16:36:04 +02:00
|
|
|
|
2012-08-18 04:03:08 +02:00
|
|
|
if sound_playing > 1 and time < 0.05 then
|
|
|
|
sound_playing = 0.05
|
2012-08-17 16:36:04 +02:00
|
|
|
end
|
2012-08-18 04:03:08 +02:00
|
|
|
|
|
|
|
--random wolves & owls at night
|
|
|
|
if time > 0.8 or time < 0.2 then
|
|
|
|
if math.random(10000) >9997 then
|
|
|
|
minetest.sound_play("Wolves_Howling")
|
|
|
|
end
|
|
|
|
if math.random(10000) >9997 then
|
|
|
|
minetest.sound_play("horned_owl")
|
|
|
|
end
|
|
|
|
end
|
2012-08-17 23:10:53 +02:00
|
|
|
if time > sound_playing then
|
2012-08-17 16:36:04 +02:00
|
|
|
|
2012-08-17 23:10:53 +02:00
|
|
|
if time > 0.8 or time < 0.2 then
|
2012-08-18 04:03:08 +02:00
|
|
|
sound_playing = time + 0.07
|
2012-08-17 23:10:53 +02:00
|
|
|
minetest.sound_play("Crickets_At_NightCombo")
|
2012-08-18 04:03:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-17 23:10:53 +02:00
|
|
|
return true
|
|
|
|
end
|
2012-08-17 16:36:04 +02:00
|
|
|
|
2012-08-17 23:10:53 +02:00
|
|
|
sound_playing = time + 0.1
|
|
|
|
minetest.sound_play("bird")
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end)
|