diff --git a/init.lua b/init.lua index ff97ee8..90c33d6 100644 --- a/init.lua +++ b/init.lua @@ -1,13 +1,13 @@ local night = { handler = {}, - frequency = 5, + frequency = 10, {name="horned_owl", length=3}, {name="Wolves_Howling", length=11} } local night_frequent = { handler = {}, - frequency = 50, + frequency = 25, {name="Crickets_At_NightCombo", length=69} } @@ -21,7 +21,7 @@ local day = { local day_frequent = { handler = {}, - frequency = 50, + frequency = 25, {name="robin2", length=43}, {name="birdsongnl", length=72}, {name="bird", length=30} @@ -35,7 +35,7 @@ local cave = { local cave_frequent = { handler = {}, - frequency = 50, + frequency = 100, {name="drippingwater_drip_a", length=2}, {name="drippingwater_drip_b", length=2}, {name="drippingwater_drip_c", length=2}, @@ -43,6 +43,23 @@ local cave_frequent = { {name="Spooky_Water_Drops", length=7} } +local water = { + handler = {}, + frequency = 0,--dolphins dont fit into small lakes + {name="dolphins", length=6}, + {name="dolphins_screaming", length=16.5} +} + +local water_frequent = { + handler = {}, + frequency = 100, + {name="scuba1bubbles", length=11}, + {name="scuba1calm", length=10}, + {name="scuba1calm2", length=8.5}, + {name="scuba1interestingbubbles", length=11}, + {name="scuba1tubulentbubbles", length=10.5} +} + local play_music = minetest.setting_getbool("music") or false local music = { handler = {}, @@ -51,10 +68,20 @@ local music = { } local is_daytime = function() - return (minetest.env:get_timeofday() > 0.2 or minetest.env:get_timeofday() < 0.8) + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) end local get_ambience = function(player) + local pos = player:getpos() + pos.y = pos.y+1.5 + local nodename = minetest.env:get_node(pos).name + if string.find(nodename, "default:water") then + if music then + return {water=water, water_frequent=water_frequent, music=music} + else + return {water=water, water_frequent=water_frequent} + end + end if player:getpos().y < 0 then if music then return {cave=cave, cave_frequent=cave_frequent, music=music} @@ -152,12 +179,26 @@ local stop_sound = function(still_playing, player) list.handler[player_name] = nil end end + if still_playing.water == nil then + local list = water + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water_frequent == nil then + local list = water_frequent + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end end local timer = 0 minetest.register_globalstep(function(dtime) timer = timer+dtime - if timer < 5 then + if timer < 1 then return end timer = 0 diff --git a/sounds/SoundLicenses.txt b/sounds/SoundLicenses.txt index 2a853bf..afdd5cd 100644 --- a/sounds/SoundLicenses.txt +++ b/sounds/SoundLicenses.txt @@ -25,6 +25,13 @@ --bluejay.wav, Creative Commons 0 License, UncleSigmund, http://www.freesound.org/people/UncleSigmund/sounds/42382/ +--scuba1*.ogg- digifishmusic, Attribution License, http://www.freesound.org/people/digifishmusic/sounds/45521/ + +--Underwater Pool - Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/1660-Underwater-Pool.html + +--dolphin_screaming - Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/161691/ + +--dolphins - Attribution Noncommercial License, acclivity, http://www.freesound.org/people/acclivity/sounds/13691/ --natural night sounds in Boquete.wav, Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/15851/ diff --git a/sounds/Underwater_Pool.ogg b/sounds/Underwater_Pool.ogg new file mode 100644 index 0000000..94be4f7 Binary files /dev/null and b/sounds/Underwater_Pool.ogg differ diff --git a/sounds/dolphins.ogg b/sounds/dolphins.ogg new file mode 100644 index 0000000..9c2a17e Binary files /dev/null and b/sounds/dolphins.ogg differ diff --git a/sounds/dolphins_screaming.ogg b/sounds/dolphins_screaming.ogg new file mode 100644 index 0000000..787b6f4 Binary files /dev/null and b/sounds/dolphins_screaming.ogg differ diff --git a/sounds/scuba1bubbles.ogg b/sounds/scuba1bubbles.ogg new file mode 100644 index 0000000..ffc1431 Binary files /dev/null and b/sounds/scuba1bubbles.ogg differ diff --git a/sounds/scuba1calm.ogg b/sounds/scuba1calm.ogg new file mode 100644 index 0000000..57b810d Binary files /dev/null and b/sounds/scuba1calm.ogg differ diff --git a/sounds/scuba1calm2.ogg b/sounds/scuba1calm2.ogg new file mode 100644 index 0000000..e8a6f42 Binary files /dev/null and b/sounds/scuba1calm2.ogg differ diff --git a/sounds/scuba1interestingbubbles.ogg b/sounds/scuba1interestingbubbles.ogg new file mode 100644 index 0000000..761cbf6 Binary files /dev/null and b/sounds/scuba1interestingbubbles.ogg differ diff --git a/sounds/scuba1tubulentbubbles.ogg b/sounds/scuba1tubulentbubbles.ogg new file mode 100644 index 0000000..535c1a9 Binary files /dev/null and b/sounds/scuba1tubulentbubbles.ogg differ