diff --git a/README.md b/README.md index 15a705e..daab3b5 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,4 @@ Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers 0.4 - Code optimized 0.5 - Changed to kilbiths smaller sound files and removed canadianloon1, adjusted timings 0.6 - Using new find_nodes_in_area features to count nodes and speed up execution (thanks everamzah) +0.7 - Code tweaks and added Jungle sounds for day and night time diff --git a/init.lua b/init.lua index f30b739..07b26c9 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ ---= Ambience lite by TenPlus1 (1st April 2016) +--= Ambience lite by TenPlus1 (6th June 2016) local max_frequency_all = 1000 -- larger number means more frequent sounds (100-2000) local SOUNDVOLUME = 1 @@ -8,6 +8,7 @@ local ambiences local played_on_start = false -- sound sets + local night = { handler = {}, frequency = 40, {name = "hornedowl", length = 2}, @@ -46,7 +47,8 @@ local beach = { handler = {}, frequency = 40, {name = "seagull", length = 4.5}, {name = "beach", length = 13}, - {name = "gull", length = 1} + {name = "gull", length = 1}, + {name = "beach_2", length = 6}, } local desert = { @@ -86,14 +88,20 @@ local largefire = { } local jungle = { - handler = {}, frequency = 60, - {name = "jungle", length = 4}, + handler = {}, frequency = 200, + {name = "jungle_day_1", length = 7}, {name = "deer", length = 7}, {name = "canadianloon2", length = 14}, {name = "bird1", length = 11}, - {name = "bird2", length = 6}, {name = "peacock", length = 2}, - {name = "bluejay", length = 6}, +} + +local jungle_night = { + handler = {}, frequency = 200, + {name = "jungle_night_1", length = 4}, + {name = "jungle_night_2", length = 4}, + {name = "deer", length = 7}, + {name = "frog", length = 1}, } local radius = 6 @@ -104,7 +112,7 @@ local num_fire, num_lava, num_water_flowing, num_water_source, local get_ambience = function(player) -- who and where am I? - local player_name = player:get_player_name() + --local player_name = player:get_player_name() local pos = player:getpos() -- what is around me? @@ -118,11 +126,13 @@ local get_ambience = function(player) --= START Ambiance - if minetest.get_item_group(nod_head, "water") > 0 then + if minetest.registered_nodes[nod_head] + and minetest.registered_nodes[nod_head].groups.water then return {underwater = underwater} end - if minetest.get_item_group(nod_feet, "water") > 0 then + if minetest.registered_nodes[nod_feet] + and minetest.registered_nodes[nod_feet].groups.water then return {splash = splash} end @@ -203,6 +213,11 @@ print ( return {day = day} else + + if num_jungletree > 100 then + return {jungle_night = jungle_night} + end + return {night = night} end @@ -215,9 +230,10 @@ local play_sound = function(player_name, list, number) if list.handler[player_name] == nil then - local gain = volume * SOUNDVOLUME - local handler = minetest.sound_play(list[number].name, - {to_player = player_name, gain = gain}) + local handler = minetest.sound_play(list[number].name, { + to_player = player_name, + gain = volume * SOUNDVOLUME + }) if handler then @@ -272,6 +288,7 @@ local still_playing = function(still_playing, player_name) if not still_playing.smallfire then stop_sound(smallfire, player_name) end if not still_playing.largefire then stop_sound(largefire, player_name) end if not still_playing.jungle then stop_sound(jungle, player_name) end + if not still_playing.jungle_night then stop_sound(jungle_night, player_name) end end -- player routine @@ -283,13 +300,15 @@ minetest.register_globalstep(function(dtime) if timer < 1 then return end timer = 0 - for _,player in pairs(minetest.get_connected_players()) do + local players = minetest.get_connected_players() - local player_name = player:get_player_name() + for n = 1, #players do + + local player_name = players[n]:get_player_name() --local t1 = os.clock() - ambiences = get_ambience(player) + ambiences = get_ambience(players[n]) --print(string.format("elapsed time: %.4f\n", os.clock() - t1)) diff --git a/sounds/SoundLicenses.txt b/sounds/SoundLicenses.txt index 7bee6c6..db5118e 100644 --- a/sounds/SoundLicenses.txt +++ b/sounds/SoundLicenses.txt @@ -1,20 +1,3 @@ ---------------Music Lic: -Amethystium: ---Avalon ---Ethereal ---Faraway ---Strangely Beautiful - -"I can't give you a formal license (legal paperwork) for it, but as long as it's non-commercial I can give you my personal blessing and guarantee that you won't get in trouble for using it :) If that's enough just feel free to use any of my tracks. Please credit the music properly though, and include a link to www.amethystium.com and www.am.mu (it's the same site right now, but the latter will be a label/music store site soon). -Best regards, -Øystein Ramfjord" - -Jordach: ---dark_ambiance ---eastern_feeling -These sounds are used for the Mod for Minetest; Ambiance. -The included sounds are http://creativecommons.org/licenses/by-nc-sa/3.0/ -Not Used:--mtest -----------Sound Lic: --Nightime Sound, Recorded by Mike Koenig, License: Attribution 3.0 http://soundbible.com/951-Nightime.html @@ -115,4 +98,6 @@ http://www.jamendo.com/en/track/904012/dance-of-magical-flowers http://www.jamendo.com/en/track/904013/magic-of-the-seventh-world http://www.jamendo.com/en/track/904016/in-search-of-the-soul +http://www.freesfx.co.uk/soundeffects/forests-jungles/ + zero-project diff --git a/sounds/beach_2.ogg b/sounds/beach_2.ogg new file mode 100644 index 0000000..461ad0f Binary files /dev/null and b/sounds/beach_2.ogg differ diff --git a/sounds/jungle.ogg b/sounds/jungle.ogg deleted file mode 100644 index c27945a..0000000 Binary files a/sounds/jungle.ogg and /dev/null differ diff --git a/sounds/jungle_day_1.ogg b/sounds/jungle_day_1.ogg new file mode 100644 index 0000000..9ec8f13 Binary files /dev/null and b/sounds/jungle_day_1.ogg differ diff --git a/sounds/jungle_night_1.ogg b/sounds/jungle_night_1.ogg new file mode 100644 index 0000000..56ba29b Binary files /dev/null and b/sounds/jungle_night_1.ogg differ diff --git a/sounds/jungle_night_2.ogg b/sounds/jungle_night_2.ogg new file mode 100644 index 0000000..9ec3b05 Binary files /dev/null and b/sounds/jungle_night_2.ogg differ