diff --git a/mods/ambience/14init.lua b/mods/ambience/14init.lua new file mode 100644 index 00000000..1f4acd6d --- /dev/null +++ b/mods/ambience/14init.lua @@ -0,0 +1,390 @@ +-------------------------------------------------------------------------------------------------------- +--Ambiance Configuration for version .14 + +local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000. + +--for frequencies below use a number between 0 and max_frequency_all +--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds +local night_frequency = 20 --owls, wolves +local night_volume = 0.9 +local night_frequent_frequency = 150 --crickets +local night_frequent_volume = 0.9 +local day_frequency = 100 --crow, bluejay, cardinal +local day_volume = 0.9 +local day_frequent_frequency = 1000 --crow, bluejay, cardinal +local day_frequent_volume = 0.18 +local cave_frequency = 10 --bats +local cave_volume = 1.0 +local cave_frequent_frequency = 70 --drops of water dripping +local cave_frequent_volume = 1.0 +local water_frequent_frequency = 1000 --water sounds +local water_frequent_volume = 1.0 +local music_frequency = 7 --music (suggestion: keep this one low like around 6) +local music_volume = 0.3 +--End of Config +---------------------------------------------------------------------------------------------------- +local played_on_start = false +local night = { + handler = {}, + frequency = night_frequency, + {name="horned_owl", length=3, gain=night_volume}, + {name="Wolves_Howling", length=11, gain=night_volume}, + {name="ComboWind", length=17, gain=night_volume} +} + +local night_frequent = { + handler = {}, + frequency = night_frequent_frequency, + {name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume} +} + +local day = { + handler = {}, + frequency = day_frequency, + {name="Best Cardinal Bird", length=4, gain=day_volume}, + {name="craw", length=3, gain=day_volume}, + {name="bluejay", length=18, gain=day_volume}, + {name="ComboWind", length=17, gain=day_volume} +} + +local day_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="robin2", length=16, gain=day_frequent_volume}, + {name="birdsongnl", length=13, gain=day_frequent_volume}, + {name="bird", length=30, gain=day_frequent_volume}, + {name="Best Cardinal Bird", length=4, gain=day_frequent_volume}, + {name="craw", length=3, gain=day_frequent_volume}, + {name="bluejay", length=18, gain=day_frequent_volume}, + {name="ComboWind", length=17, gain=day_frequent_volume*3} +} + + +local cave = { + handler = {}, + frequency = cave_frequency, + {name="Bats_in_Cave", length=5, gain=cave_volume} +} + +local cave_frequent = { + handler = {}, + frequency = cave_frequent_frequency, + {name="drippingwater_drip_a", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_b", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_c", length=2, gain=cave_frequent_volume}, + {name="Single_Water_Droplet", length=3, gain=cave_frequent_volume}, + {name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume} +} + +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 = water_frequent_frequency, + on_stop = "drowning_gasp", + on_start = "Splash", + {name="scuba1bubbles", length=11, gain=water_frequent_volume}, + {name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. + {name="scuba1calm2", length=8.5, gain=water_frequent_volume}, + {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume}, + {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume} +} + +local flowing_water = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=14, gain=.4} +} +local flowing_water2 = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=11, gain=.3} +} + +local lava = { + handler = {}, + frequency = 1000, + {name="earth01a", length=20} +} +local lava2 = { + handler = {}, + frequency = 1000, + {name="earth01a", length=15} +} + +local play_music = minetest.setting_getbool("music") or false +local music = { + handler = {}, + frequency = music_frequency, + {name="mtest", length=4*60+33, gain=music_volume}, + {name="echos", length=2*60+26, gain=music_volume}, + {name="FoamOfTheSea", length=1*60+50, gain=music_volume}, + {name="eastern_feeling", length=3*60+51, gain=music_volume}, + {name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume}, + {name="dark_ambiance", length=44, gain=music_volume} +} + +local is_daytime = function() + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) +end + +--[[old +local nodes_in_range = function(pos, search_distance, node_name) + local search_p = {x=0, y=0, z=0} + local nodes_found = 0 + for p_x=(pos.x-search_distance), (pos.x+search_distance) do + for p_y=(pos.y-search_distance), (pos.y+search_distance) do + for p_z=(pos.z-search_distance), (pos.z+search_distance) do + local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z}) + if search_n.name == node_name then + nodes_found = nodes_found + 1 + end + end + end + end + return nodes_found + --minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")") +end --]] + +local nodes_in_range = function(pos, search_distance, node_name) + minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance} + maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + + +local get_ambience = function(player) + local pos = player:getpos() + pos.y = pos.y+1.0 + 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 nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then + if music then + return {lava=lava, lava2=lava2, music=music} + else + return {lava=lava} + end + end + if nodes_in_range(pos, 7, "default:water_flowing")>5 then + if music then + return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music} + else + return {flowing_water=flowing_water, flowing_water2=flowing_water2} + end + end + if player:getpos().y < 0 then + if music then + return {cave=cave, cave_frequent=cave_frequent, music=music} + else + return {cave=cave, cave_frequent=cave_frequent} + end + end + if is_daytime() then + if music then + return {day=day, day_frequent=day_frequent, music=music} + else + return {day=day, day_frequent=day_frequent} + end + else + if music then + return {night=night, night_frequent=night_frequent, music=music} + else + return {night=night, night_frequent=night_frequent} + end + end +end + +-- start playing the sound, set the handler and delete the handler after sound is played +local play_sound = function(player, list, number) + local player_name = player:get_player_name() + if list.handler[player_name] == nil then + local gain = 1.0 + if list[number].gain ~= nil then + gain = list[number].gain + end + local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) + if handler ~= nil then + list.handler[player_name] = handler + minetest.after(list[number].length, function(args) + local list = args[1] + local player_name = args[2] + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end, {list, player_name}) + end + end +end + +-- stops all sounds that are not in still_playing +local stop_sound = function(still_playing, player) + local player_name = player:get_player_name() + if still_playing.cave == nil then + local list = cave + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.cave_frequent == nil then + local list = cave_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night == nil then + local list = night + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night_frequent == nil then + local list = night_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day == nil then + local list = day + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day_frequent == nil then + local list = day_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.music == nil then + local list = music + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water == nil then + local list = flowing_water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water2 == nil then + local list = flowing_water2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava == nil then + local list = lava + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava2 == nil then + local list = lava2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water == nil then + local list = water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + 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 + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + played_on_start = false + end + 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 < 1 then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + local ambiences = get_ambience(player) + stop_sound(ambiences, player) + for _,ambience in pairs(ambiences) do + if math.random(1, 1000) <= ambience.frequency then + if ambience.on_start ~= nil and played_on_start == false then + played_on_start = true + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + end + play_sound(player, ambience, math.random(1, #ambience)) + end + end + end +end) \ No newline at end of file diff --git a/mods/ambience/Badinit.lua b/mods/ambience/Badinit.lua new file mode 100644 index 00000000..ba85193e --- /dev/null +++ b/mods/ambience/Badinit.lua @@ -0,0 +1,439 @@ +-------------------------------------------------------------------------------------------------------- +--Ambiance Configuration for version .16 + +local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000. + +--for frequencies below use a number between 0 and max_frequency_all +--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds +local night_frequency = 20 --owls, wolves +local night_volume = 0.9 +local night_frequent_frequency = 150 --crickets +local night_frequent_volume = 0.9 +local day_frequency = 100 --crow, bluejay, cardinal +local day_volume = 0.9 +local day_frequent_frequency = 1000 --crow, bluejay, cardinal +local day_frequent_volume = 0.18 +local cave_frequency = 10 --bats +local cave_volume = 1.0 +local cave_frequent_frequency = 70 --drops of water dripping +local cave_frequent_volume = 1.0 +local beach_frequency = 20 --seagulls +local beach_volume = 1.0 +local beach_frequent_frequency = 1000 --waves +local beach_frequent_volume = 1.0 +local water_frequent_frequency = 1000 --water sounds +local water_frequent_volume = 1.0 +local music_frequency = 7 --music (suggestion: keep this one low like around 6) +local music_volume = 0.3 +--End of Config +---------------------------------------------------------------------------------------------------- +local played_on_start = false +local night = { + handler = {}, + frequency = night_frequency, + {name="horned_owl", length=3, gain=night_volume}, + {name="Wolves_Howling", length=11, gain=night_volume}, + {name="ComboWind", length=17, gain=night_volume} +} + +local night_frequent = { + handler = {}, + frequency = night_frequent_frequency, + {name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume} +} + +local day = { + handler = {}, + frequency = day_frequency, + {name="Best Cardinal Bird", length=4, gain=day_volume}, + {name="craw", length=3, gain=day_volume}, + {name="bluejay", length=18, gain=day_volume}, + {name="ComboWind", length=17, gain=day_volume} +} + +local day_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="robin2", length=16, gain=day_frequent_volume}, + {name="birdsongnl", length=13, gain=day_frequent_volume}, + {name="bird", length=30, gain=day_frequent_volume}, + {name="Best Cardinal Bird", length=4, gain=day_frequent_volume}, + {name="craw", length=3, gain=day_frequent_volume}, + {name="bluejay", length=18, gain=day_frequent_volume}, + {name="ComboWind", length=17, gain=day_frequent_volume*3} +} + + +local cave = { + handler = {}, + frequency = cave_frequency, + {name="Bats_in_Cave", length=5, gain=cave_volume} +} + +local cave_frequent = { + handler = {}, + frequency = cave_frequent_frequency, + {name="drippingwater_drip_a", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_b", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_c", length=2, gain=cave_frequent_volume}, + {name="Single_Water_Droplet", length=3, gain=cave_frequent_volume}, + {name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume} +} + +local beach = { + handler = {}, + frequency = beach_frequency, + {name="seagull", length=4.5, gain=beach_volume} +} + +local beach_frequent = { + handler = {}, + frequency = beach_frequent_frequency, + {name="fiji_beach", length=43.5, gain=beach_frequent_volume} +} + + +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 = water_frequent_frequency, + on_stop = "drowning_gasp", + on_start = "Splash", + {name="scuba1bubbles", length=11, gain=water_frequent_volume}, + {name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. + {name="scuba1calm2", length=8.5, gain=water_frequent_volume}, + {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume}, + {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume} +} + +local flowing_water = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=14, gain=.4} +} +local flowing_water2 = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=11, gain=.3} +} + +local lava = { + handler = {}, + frequency = 1000, + {name="earth01a", length=20} +} +local lava2 = { + handler = {}, + frequency = 1000, + {name="earth01a", length=15} +} + + +local play_music = minetest.setting_getbool("music") or false +local music = { + handler = {}, + frequency = music_frequency, + {name="mtest", length=4*60+33, gain=music_volume}, + {name="echos", length=2*60+26, gain=music_volume}, + {name="FoamOfTheSea", length=1*60+50, gain=music_volume}, + {name="eastern_feeling", length=3*60+51, gain=music_volume}, + {name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume}, + {name="dark_ambiance", length=44, gain=music_volume} +} + +local is_daytime = function() + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) +end + +--[[old +local nodes_in_range = function(pos, search_distance, node_name) + local search_p = {x=0, y=0, z=0} + local nodes_found = 0 + for p_x=(pos.x-search_distance), (pos.x+search_distance) do + for p_y=(pos.y-search_distance), (pos.y+search_distance) do + for p_z=(pos.z-search_distance), (pos.z+search_distance) do + local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z}) + if search_n.name == node_name then + nodes_found = nodes_found + 1 + end + end + end + end + return nodes_found + --minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")") +end --]] + +local nodes_in_range = function(pos, search_distance, node_name) + minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance} + maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + + +local get_ambience = function(player) + local pos = player:getpos() + pos.y = pos.y+1.0 + 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 nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then + if music then + return {lava=lava, lava2=lava2, music=music} + else + return {lava=lava} + end + end + if nodes_in_range(pos, 7, "default:water_flowing")>5 then + if music then + return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music} + else + return {flowing_water=flowing_water, flowing_water2=flowing_water2} + end + end + pos.y = pos.y-2 + nodename = minetest.env:get_node(pos).name + --minetest.chat_send_all("Found " .. nodename .. pos.y ) + if string.find(nodename, "default:sand") and pos.y < 5 then + if music then + return {beach=beach, beach_frequent=beach_frequent, music=music} + else + return {beach=beach, beach_frequent=beach_frequent} + end + end + if player:getpos().y < 0 then + if music then + return {cave=cave, cave_frequent=cave_frequent, music=music} + else + return {cave=cave, cave_frequent=cave_frequent} + end + end + if is_daytime() then + if music then + return {day=day, day_frequent=day_frequent, music=music} + else + return {day=day, day_frequent=day_frequent} + end + else + if music then + return {night=night, night_frequent=night_frequent, music=music} + else + return {night=night, night_frequent=night_frequent} + end + end +end + +-- start playing the sound, set the handler and delete the handler after sound is played +local play_sound = function(player, list, number) + local player_name = player:get_player_name() + if list.handler[player_name] == nil then + local gain = 1.0 + if list[number].gain ~= nil then + gain = list[number].gain + end + local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) + if handler ~= nil then + list.handler[player_name] = handler + minetest.after(list[number].length, function(args) + local list = args[1] + local player_name = args[2] + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end, {list, player_name}) + end + end +end + +-- stops all sounds that are not in still_playing +local stop_sound = function(still_playing, player) + local player_name = player:get_player_name() + if still_playing.cave == nil then + local list = cave + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.cave_frequent == nil then + local list = cave_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach == nil then + local list = beach + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach_frequent == nil then + local list = beach_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + + if still_playing.night == nil then + local list = night + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night_frequent == nil then + local list = night_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day == nil then + local list = day + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day_frequent == nil then + local list = day_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.music == nil then + local list = music + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water == nil then + local list = flowing_water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water2 == nil then + local list = flowing_water2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava == nil then + local list = lava + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava2 == nil then + local list = lava2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water == nil then + local list = water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + 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 + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + played_on_start = false + end + 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 < 1 then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + local ambiences = get_ambience(player) + stop_sound(ambiences, player) + for _,ambience in pairs(ambiences) do + if math.random(1, 1000) <= ambience.frequency then + if ambience.on_start ~= nil and played_on_start == false then + played_on_start = true + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + end + play_sound(player, ambience, math.random(1, #ambience)) + end + end + end +end) \ No newline at end of file diff --git a/mods/ambience/README.md b/mods/ambience/README.md deleted file mode 100755 index 44ae8c88..00000000 --- a/mods/ambience/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Ambience Lite mod for Minetest - -Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers with new fire sounds added when Fire Redo mod is detected... - -0.1 - Initial release -0.2 - Code change and new water sounds added -0.3 - Works with Fire Redo mod to provide fire sounds -0.4 - Code optimized -0.5 - Changed to kilbiths smaller sound files and removed canadianloon1, adjusted timings diff --git a/mods/ambience/depends.txt b/mods/ambience/depends.txt old mode 100755 new mode 100644 index 5d962f9c..4ad96d51 --- a/mods/ambience/depends.txt +++ b/mods/ambience/depends.txt @@ -1,5 +1 @@ default -fire? -bakedclay? -ethereal? -soundset? diff --git a/mods/ambience/init.lua b/mods/ambience/init.lua old mode 100755 new mode 100644 index 66259ec0..871972c5 --- a/mods/ambience/init.lua +++ b/mods/ambience/init.lua @@ -1,266 +1,690 @@ - ---= Ambience lite by TenPlus1 (16th April 2015) - -local max_frequency_all = 1000 -- larger number means more frequent sounds (100-2000) -local SOUNDVOLUME = 1 - --- compatibility with soundset mod -local get_volume -if (minetest.get_modpath("soundset")) ~= nil then - get_volume = soundset.get_gain -else - get_volume = function (player_name, sound_type) return SOUNDVOLUME end - -- set volume command - minetest.register_chatcommand("svol", { - params = "", - description = "set sound volume (0.1 to 1.0)", - privs = {server=true}, - func = function(name, param) - if tonumber(param) then - SOUNDVOLUME = tonumber(param) - minetest.chat_send_player(name, "Sound volume set.") - else - minetest.chat_send_player(name, "Sound volume no set, bad param.") - end - end, - }) -end - - --- sound sets -local night = { - handler = {}, frequency = 40, - {name="hornedowl", length=2}, - {name="wolves", length=4}, - {name="cricket", length=6}, - {name="deer", length=7}, - {name="frog", length=1}, -} - -local day = { - handler = {}, frequency = 40, - {name="cardinal", length=3}, - {name="bluejay", length=6}, - {name="craw", length=3}, - {name="canadianloon2", length=14}, - {name="robin", length=4}, - {name="bird1", length=11}, - {name="bird2", length=6}, - {name="crestedlark", length=6}, - {name="peacock", length=2} -} - -local high_up = { - handler = {}, frequency = 40, - {name="craw", length=3}, - {name="wind", length=9.5}, -} - -local cave = { - handler = {}, frequency = 60, - {name="drippingwater1", length=1.5}, - {name="drippingwater2", length=1.5} -} - -local beach = { - handler = {}, frequency = 40, - {name="seagull", length=4.5}, - {name="beach", length=13}, - {name="gull", length=1} -} - -local desert = { - handler = {}, frequency = 20, - {name="coyote", length=2.5}, - {name="desertwind", length=8} -} - -local flowing_water = { - handler = {}, frequency = 1000, - {name="waterfall", length=6} -} - -local underwater = { - handler = {}, frequency = 1000, - {name="scuba", length=8} -} - -local splash = { - handler = {}, frequency = 1000, - {name="swim_splashing", length=3}, -} - -local lava = { - handler = {}, frequency = 1000, - {name="lava", length=7} -} - -local smallfire = { - handler = {}, frequency = 1000, - {name="fire_small", length=6} -} - -local largefire = { - handler = {}, frequency = 1000, - {name="fire_large", length=8} -} - -local get_num_nodes = function(pos, nodes) - return #minetest.find_nodes_in_area( - {x=pos.x-6,y=pos.y-2, z=pos.z-6}, - {x=pos.x+6,y=pos.y+3, z=pos.z+6}, - nodes - ) -end - --- check where player is and which sounds are played -local get_ambience = function(player) - - -- where am I? - local pos = player:getpos() - - -- what is around me? - local nod_head = minetest.get_node({x=pos.x,y=pos.y+1.4, z=pos.z}).name - if string.find(nod_head, "water_") then - return {underwater=underwater} - end - local nod_feet = minetest.get_node({x=pos.x,y=pos.y+0.2, z=pos.z}).name - if string.find(nod_feet, "water_") then - return {splash=splash} - end - - --= START Ambiance - - -- is fire redo mod active? - if fire and fire.mod and fire.mod == "redo" then - local num_fire = get_num_nodes(pos, {"fire:basic_flame", "bakedclay:safe_fire"}) - --print("num_fire:"..dump(num_fire)) - if num_fire > 8 then - return {largefire=largefire} - elseif num_fire > 0 then - return {smallfire=smallfire} - end - end - - local num_lava = get_num_nodes(pos, {"default:lava_flowing", "default:lava_source"}) - --print("num_lava:"..dump(num_lava)) - if num_lava > 5 then - return {lava=lava} - end - - local num_water_flowing = get_num_nodes(pos, {"default:water_flowing", "default:river_water_flowing"}) - --print("num_water_flowing:"..dump(num_water_flowing)) - if num_water_flowing > 30 then - return {flowing_water=flowing_water} - end - - if pos.y < 7 and pos.y > 0 then - local num_water_source = get_num_nodes(pos, {"default:water_source", "default:river_water_source"}) - --print("num_water_source:"..dump(num_water_source)) - if num_water_source > 100 then - return {beach=beach} - end - end - - local num_desert = get_num_nodes(pos, {"default:desert_sand", "default:desert_stone"}) - --print("num_desert:"..dump(num_desert)) - if num_desert > 150 then - return {desert=desert} - end - - if pos.y > 60 then - return {high_up=high_up} - end - - if pos.y < -10 then - return {cave=cave} - end - - if minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8 then - return {day=day} - else - return {night=night} - end - - -- END Ambiance - -end - --- play sound, set handler then delete handler when sound finished -local play_sound = function(player, list, number) - - local player_name = player:get_player_name() - - if list.handler[player_name] == nil then - - local gain = get_volume(player:get_player_name(), "ambience") - local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) - - if handler then - list.handler[player_name] = handler - - minetest.after(list[number].length, function(args) - local list = args[1] - local player_name = args[2] - - if list.handler[player_name] then - minetest.sound_stop(list.handler[player_name]) - list.handler[player_name] = nil - end - end, {list, player_name}) - end - end -end - --- stop sound in still_playing -local stop_sound = function (list, player) - - local player_name = player:get_player_name() - - if list.handler[player_name] then - if list.on_stop then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=get_volume(player:get_player_name(), "ambience")}) - end - minetest.sound_stop(list.handler[player_name]) - list.handler[player_name] = nil - end - -end - --- check sounds that are not in still_playing -local still_playing = function(still_playing, player) - if not still_playing.cave then stop_sound(cave, player) end - if not still_playing.high_up then stop_sound(high_up, player) end - if not still_playing.beach then stop_sound(beach, player) end - if not still_playing.desert then stop_sound(desert, player) end - if not still_playing.night then stop_sound(night, player) end - if not still_playing.day then stop_sound(day, player) end - if not still_playing.flowing_water then stop_sound(flowing_water, player) end - if not still_playing.splash then stop_sound(splash, player) end - if not still_playing.underwater then stop_sound(underwater, player) end - if not still_playing.lava then stop_sound(lava, player) end - if not still_playing.smallfire then stop_sound(smallfire, player) end - if not still_playing.largefire then stop_sound(largefire, player) end -end - - -local function tick() - for _,player in ipairs(minetest.get_connected_players()) do - local playername = player:get_player_name() - local gain = get_volume(playername, "ambience") - if gain > 0 then - --local t1 = os.clock() - local ambiences = get_ambience(player) - --print ("[AMBIENCE] "..math.ceil((os.clock() - t1) * 1000).." ms") - still_playing(ambiences, player) - for _,ambience in pairs(ambiences) do - if math.random(1, 1000) <= ambience.frequency then - play_sound(player, ambience, math.random(1, #ambience)) - end - end - end - end - minetest.after(1, tick) -end - -minetest.after(10, tick) +-------------------------------------------------------------------------------------------------------- +--Ambience Configuration for version .34 +--Added Faraway & Ethereal by Amethystium + +--Working on: +--removing magic leap when not enough air under feet. + + +--find out why wind stops while flying +--add an extra node near feet to handle treading water as a special case, and don't have to use node under feet. which gets + --invoked when staning on a ledge near water. +--reduce redundant code (stopplay and add ambience to list) + +local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000. + +--for frequencies below use a number between 0 and max_frequency_all +--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds +local night_frequency = 20 --owls, wolves +local night_volume = 0.9 +local night_frequent_frequency = 150 --crickets +local night_frequent_volume = 0.9 +local day_frequency = 80 --crow, bluejay, cardinal +local day_volume = 0.9 +local day_frequent_frequency = 250 --crow, bluejay, cardinal +local day_frequent_volume = 0.18 +local cave_frequency = 10 --bats +local cave_volume = 1.0 +local cave_frequent_frequency = 70 --drops of water dripping +local cave_frequent_volume = 1.0 +local beach_frequency = 20 --seagulls +local beach_volume = 1.0 +local beach_frequent_frequency = 1000 --waves +local beach_frequent_volume = 1.0 +local water_frequent_frequency = 1000 --water sounds +local water_frequent_volume = 1.0 +local desert_frequency = 20 --coyote +local desert_volume = 1.0 +local desert_frequent_frequency = 700 --desertwind +local desert_frequent_volume = 1.0 +local swimming_frequent_frequency = 1000 --swimming splashes +local swimming_frequent_volume = 1.0 +local water_surface_volume = 1.0 -- sloshing water +local lava_volume = 1.0 --lava +local flowing_water_volume = .4 --waterfall +local splashing_water_volume = 1 +local music_frequency = 7 --music (suggestion: keep this one low like around 6) +local music_volume = 0.3 + +--End of Config +---------------------------------------------------------------------------------------------------- +local ambiences +local counter=0--***************** +local SOUNDVOLUME = 1 +local MUSICVOLUME = 1 +local sound_vol = 1 +local volume = {} +local last_x_pos = 0 +local last_y_pos = 0 +local last_z_pos = 0 +local node_under_feet +local node_at_upper_body +local node_at_lower_body +local node_3_under_feet +local played_on_start = false +local world_path = minetest.get_worldpath() + +local function load_volumes() + local file, err = io.open(world_path.."/ambience_volumes", "r") + if err then + return + end + for line in file:lines() do + local config_line = string.split(line, ":") + volume[config_line[1]] = {music=config_line[2],sound=config_line[3]} + end + file:close() +end + +load_volumes() + +local night = { + handler = {}, + frequency = night_frequency, + {name="horned_owl", length=3, gain=night_volume}, + {name="Wolves_Howling", length=11, gain=night_volume}, + {name="ComboWind", length=17, gain=night_volume}, + {name="deer", length=8, gain=night_volume*2}, + {name="frog", length=1, gain=night_volume} +} + +local night_frequent = { + handler = {}, + frequency = night_frequent_frequency, + {name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume} +} + +local day = { + handler = {}, + frequency = day_frequency, + {name="Best Cardinal Bird", length=4, gain=day_volume}, + {name="craw", length=3, gain=day_volume}, + {name="bluejay", length=7, gain=day_volume}, + {name="ComboWind", length=17, gain=day_volume}, + {name="canadianloon2", length=15, gain=day_volume}, + {name="peacock", length=3, gain=day_volume} +} + +local day_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="robin2", length=16, gain=day_frequent_volume}, + {name="birdsongnl", length=13, gain=day_frequent_volume}, + {name="bird", length=30, gain=day_frequent_volume}, + {name="Best Cardinal Bird", length=4, gain=day_frequent_volume}, + {name="craw", length=3, gain=day_frequent_volume}, + {name="bluejay", length=7, gain=day_frequent_volume}, + {name="ComboWind", length=17, gain=day_frequent_volume*3} +} +local swimming_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="water_swimming_splashing_breath", length=11.5, gain=swimming_frequent_volume}, + {name="water_swimming_splashing", length=9, gain=swimming_frequent_volume} +} + +local cave = { + handler = {}, + frequency = cave_frequency, + {name="Bats_in_Cave", length=5, gain=cave_volume} +} + +local cave_frequent = { + handler = {}, + frequency = cave_frequent_frequency, + {name="drippingwater_drip_a", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_b", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_c", length=2, gain=cave_frequent_volume}, + {name="Single_Water_Droplet", length=3, gain=cave_frequent_volume}, + {name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume} +} + +local beach = { + handler = {}, + frequency = beach_frequency, + {name="seagull", length=4.5, gain=beach_volume}, + {name="gull", length=2, gain=beach_volume} +} + +local beach_frequent = { + handler = {}, + frequency = beach_frequent_frequency, + {name="fiji_beach", length=43.5, gain=beach_frequent_volume} +} + +local desert = { + handler = {}, + frequency = desert_frequency, + {name="coyote2", length=2.5, gain=desert_volume}, + {name="RattleSnake", length=8, gain=desert_volume} +} + +local desert_frequent = { + handler = {}, + frequency = desert_frequent_frequency, + {name="DesertMonolithMed", length=34.5, gain=desert_frequent_volume} +} + +local flying = { + handler = {}, + frequency = 1000, + on_start = "nothing_yet", + on_stop = "nothing_yet", + {name="ComboWind", length=17, gain=1} +} + +local water = { + handler = {}, + frequency = 0,--dolphins dont fit into small lakes + {name="dolphins", length=6, gain=1}, + {name="dolphins_screaming", length=16.5, gain=1} +} + +local water_frequent = { + handler = {}, + frequency = water_frequent_frequency, + on_stop = "drowning_gasp", + --on_start = "Splash", + {name="scuba1bubbles", length=11, gain=water_frequent_volume}, + {name="scuba1calm", length=10, gain=water_frequent_volume}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. + {name="scuba1calm2", length=8.5, gain=water_frequent_volume}, + {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume}, + {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume} +} + +local water_surface = { + handler = {}, + frequency = 1000, + on_stop = "Splash", + on_start = "Splash", + {name="lake_waves_2_calm", length=9.5, gain=water_surface_volume}, + {name="lake_waves_2_variety", length=13.1, gain=water_surface_volume} +} +local splashing_water = { + handler = {}, + frequency = 1000, + {name="Splash", length=1.22, gain=splashing_water_volume} +} + +local flowing_water = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=14, gain=flowing_water_volume} +} +local flowing_water2 = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=11, gain=flowing_water_volume} +} + +local lava = { + handler = {}, + frequency = 1000, + {name="earth01a", length=20, gain=lava_volume} +} +local lava2 = { + handler = {}, + frequency = 1000, + {name="earth01a", length=15, gain=lava_volume} +} + + +local play_music = minetest.setting_getbool("music") or false +local music = { + handler = {}, + frequency = music_frequency, + is_music=true, + {name="StrangelyBeautifulShort", length=3*60+.5, gain=music_volume*.7}, + {name="AvalonShort", length=2*60+58, gain=music_volume*1.4}, + --{name="mtest", length=4*60+33, gain=music_volume}, + --{name="echos", length=2*60+26, gain=music_volume}, + --{name="FoamOfTheSea", length=1*60+50, gain=music_volume}, + {name="eastern_feeling", length=3*60+51, gain=music_volume}, + --{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume}, + {name="EtherealShort", length=3*60+4, gain=music_volume*.7}, + {name="FarawayShort", length=3*60+5, gain=music_volume*.7}, + {name="dark_ambiance", length=44, gain=music_volume}, + {name="Ambivalent", length=2*60+31, gain=music_volume}, + {name="anonnp4014", length=2*60+31, gain=music_volume*1.6}, + {name="bensound_deepblue", length=4*60+49, gain=music_volume}, + {name="bensound_ofeliasdream", length=4*60+59, gain=music_volume}, + {name="bensound_slowmotion", length=3*60+27, gain=music_volume}, + {name="rainymemory", length=2*60+8, gain=music_volume} +} + +local ambienceList = { + night=night, + night_frequent=night_frequent, + day=day, + day_frequent=day_frequent, + swimming_frequent=swimming_frequent, + cave=cave, + cave_frequent=cave_frequent, + beach=beach, + beach_frequent=beach_frequent, + desert=desert, + desert_frequent=desert_frequent, + flying=flying, + water=water, + water_frequent=water_frequent, + water_surface=water_surface, + splashing_water=splashing_water, + flowing_water=flowing_water, + flowing_water2=flowing_water2, + lava=lava, + lava2=lava2, + music=music, +} + +local is_daytime = function() + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) +end + +local nodes_in_range = function(pos, search_distance, node_name) + local minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance} + local maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance} + local nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) + --minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + +local nodes_in_coords = function(minp, maxp, node_name) + local nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) + --minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + +local atleast_nodes_in_grid = function(pos, search_distance, height, node_name, threshold) + local counter = counter +1 +-- minetest.chat_send_all("counter: (" .. counter .. ")") + local minp = {x=pos.x-search_distance,y=height, z=pos.z+20} + local maxp = {x=pos.x+search_distance,y=height, z=pos.z+20} + local nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("z+Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + local totalnodes = #nodes + minp = {x=pos.x-search_distance,y=height, z=pos.z-20} + maxp = {x=pos.x+search_distance,y=height, z=pos.z-20} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("z-Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + totalnodes = totalnodes + #nodes + maxp = {x=pos.x+20,y=height, z=pos.z+search_distance} + minp = {x=pos.x+20,y=height, z=pos.z-search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + totalnodes = totalnodes + #nodes + maxp = {x=pos.x-20,y=height, z=pos.z+search_distance} + minp = {x=pos.x-20,y=height, z=pos.z-search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + totalnodes = totalnodes + #nodes +-- minetest.chat_send_all("Found total(" .. totalnodes .. ")") + if totalnodes >= threshold*2 then + return true + end + return false +end + +local get_immediate_nodes = function(pos) + pos.y = pos.y-1 + node_under_feet = minetest.env:get_node(pos).name + pos.y = pos.y-3 + node_3_under_feet = minetest.env:get_node(pos).name + pos.y = pos.y+3 + pos.y = pos.y+2.2 + node_at_upper_body = minetest.env:get_node(pos).name + pos.y = pos.y-1.19 + node_at_lower_body = minetest.env:get_node(pos).name + pos.y = pos.y+0.99 + --minetest.chat_send_all("node_under_feet(" .. nodename .. ")") +end + + +local get_ambience = function(player) + local player_is_climbing = false + local player_is_descending = false + local player_is_moving_horiz = false + local standing_in_water = false + local pos = player:getpos() + get_immediate_nodes(pos) + + if last_x_pos ~=pos.x or last_z_pos ~=pos.z then + player_is_moving_horiz = true + end + if pos.y > last_y_pos+.5 then + player_is_climbing = true + end + if pos.y < last_y_pos-.5 then + player_is_descending = true + end + + last_x_pos =pos.x + last_z_pos =pos.z + last_y_pos =pos.y + + if string.find(node_at_upper_body, "default:water") then + if music then + return {water=water, water_frequent=water_frequent, music=music} + else + return {water=water, water_frequent=water_frequent} + end + elseif node_at_upper_body == "air" then + if string.find(node_at_lower_body, "default:water") or string.find(node_under_feet, "default:water") then + --minetest.chat_send_all("bottom counted as water") + --we found air at upperbody, and water at lower body. Now there are 4 possibilities: + --Key: under feet, moving or not + --swimming w, m swimming + --walking in water nw, m splashing + --treading water w, nm sloshing + --standing in water nw, nm beach trumps, then sloshing + if player_is_moving_horiz then + if string.find(node_under_feet, "default:water") then + if music then + return {swimming_frequent=swimming_frequent, music=music} + else + return {swimming_frequent} + end + else --didn't find water under feet: walking in water + if music then + return {splashing_water=splashing_water, music=music} + else + return {splashing_water} + end + end + else--player is not moving: treading water + if string.find(node_under_feet, "default:water") then + if music then + return {water_surface=water_surface, music=music} + else + return {water_surface} + end + else --didn't find water under feet + standing_in_water = true + end + end + end + end +-- minetest.chat_send_all("----------") +-- if not player_is_moving_horiz then +-- minetest.chat_send_all("not moving horiz") +-- else +-- minetest.chat_send_all("moving horiz") +-- end +-- minetest.chat_send_all("nub:" ..node_at_upper_body) +-- minetest.chat_send_all("nlb:" ..node_at_lower_body) +-- minetest.chat_send_all("nuf:" ..node_under_feet) +-- minetest.chat_send_all("----------") + + +-- if player_is_moving_horiz then +-- minetest.chat_send_all("playermoving") +-- end +-- if player_is_climbing then +-- minetest.chat_send_all("player Climbing") +-- end +-- minetest.chat_send_all("nub:" ..node_at_upper_body) +-- minetest.chat_send_all("nlb:" ..node_at_lower_body) +-- minetest.chat_send_all("nuf:" ..node_under_feet) +-- minetest.chat_send_all("n3uf:" ..node_3_under_feet) +-- + --local air_or_ignore = {air=true,ignore=true} +-- minp = {x=pos.x-3,y=pos.y-4, z=pos.z-3} +-- maxp = {x=pos.x+3,y=pos.y-1, z=pos.z+3} + --local air_under_player = nodes_in_coords(minp, maxp, "air") + --local ignore_under_player = nodes_in_coords(minp, maxp, "ignore") + --local air_plus_ignore_under = air_under_player + ignore_under_player +-- minetest.chat_send_all("airUnder:" ..air_under_player) +-- minetest.chat_send_all("ignoreUnder:" ..ignore_under_player) +-- minetest.chat_send_all("a+i:" ..air_plus_ignore_under) +-- minetest.chat_send_all("counter: (" .. counter .. "-----------------)") + --minetest.chat_send_all(air_or_ignore[node_under_feet]) +-- if (player_is_moving_horiz or player_is_climbing) and air_or_ignore[node_at_upper_body] and air_or_ignore[node_at_lower_body] +-- and air_or_ignore[node_under_feet] and air_plus_ignore_under == 196 and not player_is_descending then + --minetest.chat_send_all("flying!!!!") + -- if music then + -- return {flying=flying, music=music} + -- else + --- return {flying} +-- end +-- end + --minetest.chat_send_all("not flying!!!!") + + if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then + if music then + return {lava=lava, lava2=lava2, music=music} + else + return {lava=lava} + end + end + if nodes_in_range(pos, 6, "default:water_flowing")>45 then + if music then + return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music} + else + return {flowing_water=flowing_water, flowing_water2=flowing_water2} + end + end + + +--if we are near sea level and there is lots of water around the area + if pos.y < 7 and pos.y >0 and atleast_nodes_in_grid(pos, 60, 1, "default:water_source", 51 ) then + if music then + return {beach=beach, beach_frequent=beach_frequent, music=music} + else + return {beach=beach, beach_frequent=beach_frequent} + end + end + if standing_in_water then + if music then + return {water_surface=water_surface, music=music} + else + return {water_surface} + end + end + + + local desert_in_range = (nodes_in_range(pos, 6, "default:desert_sand")+nodes_in_range(pos, 6, "default:desert_stone")) + --minetest.chat_send_all("desertcount: " .. desert_in_range .. ",".. pos.y ) + if desert_in_range >250 then + if music then + return {desert=desert, desert_frequent=desert_frequent, music=music} + else + return {desert=desert, desert_frequent=desert_frequent} + end + end + +-- pos.y = pos.y-2 +-- nodename = minetest.env:get_node(pos).name +-- minetest.chat_send_all("Found " .. nodename .. pos.y ) + + + if player:getpos().y < 0 then + if music then + return {cave=cave, cave_frequent=cave_frequent, music=music} + else + return {cave=cave, cave_frequent=cave_frequent} + end + end + if is_daytime() then + if music then + return {day=day, day_frequent=day_frequent, music=music} + else + return {day=day, day_frequent=day_frequent} + end + else + if music then + return {night=night, night_frequent=night_frequent, music=music} + else + return {night=night, night_frequent=night_frequent} + end + end +end + +-- start playing the sound, set the handler and delete the handler after sound is played +local play_sound = function(player, list, number, is_music) + local player_name = player:get_player_name() + if list.handler[player_name] == nil then + local gain = 1.0 + if list[number].gain ~= nil then + if is_music then + gain = list[number].gain*volume[player_name].music + --minetest.chat_send_all("gain music: " .. gain ) + else + gain = list[number].gain*volume[player_name].sound + --minetest.chat_send_all("gain sound: " .. gain ) + end + end + local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) + if handler ~= nil then + list.handler[player_name] = handler + minetest.after(list[number].length, function(args) + local list = args[1] + local player_name = args[2] + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end, {list, player_name}) + end + end +end + +-- stops all sounds that are not in still_playing +local stop_sound = function(still_playing, player) + local player_name = player:get_player_name() + for key,value in pairs(ambienceList) do + if still_playing[key] == nil then + if value.handler[player_name] ~= nil then + if value.on_stop ~= nil then + minetest.sound_play(value.on_stop, {to_player=player_name,gain=volume[player_name].sound}) + end + minetest.sound_stop(value.handler[player_name]) + value.handler[player_name] = nil + end + end + end +end + +local timer = 0 +minetest.register_globalstep(function(dtime) + timer = timer+dtime + if timer < 1 then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + ambiences = get_ambience(player) + stop_sound(ambiences, player) + for _,ambience in pairs(ambiences) do + if math.random(1, 1000) <= ambience.frequency then +-- if(played_on_start) then +-- -- minetest.chat_send_all("playedOnStart " ) +-- else +-- -- minetest.chat_send_all("FALSEplayedOnStart " ) +-- end + if ambience.on_start ~= nil and played_on_start == false then + played_on_start = true + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) + end + -- minetest.chat_send_all("ambience: " ..ambience ) + -- if ambience.on_start ~= nil and played_on_start_flying == false then + -- played_on_start_flying = true + -- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + -- end + local is_music =false + if ambience.is_music ~= nil then + is_music = true + end + play_sound(player, ambience, math.random(1, #ambience),is_music) + end + end + end +end) + +minetest.register_on_joinplayer( + function(player) + if volume[player:get_player_name()] == nil then + volume[player:get_player_name()] = {music=MUSICVOLUME, sound=SOUNDVOLUME} + end + end) + +minetest.register_chatcommand( + "volume", + { + description = "View sliders to set sound a music volume", + func = function(name,param) + minetest.show_formspec( + name, + "ambience:volume", + "size[6,3.5]" .. + "label[0,0.5;Music]" .. + "scrollbar[0,1;5.8,0.4;horizontal;music;" .. volume[name].music * 1000 .. "]" .. + "label[0,1.5;Sound]" .. + "scrollbar[0,2;5.8,0.4;horizontal;sound;" .. volume[name].sound * 1000 .. "]" .. + "button_exit[2,2.8;2,0.8;quit;Done]" + ) + end, + }) + +minetest.register_on_player_receive_fields( + function(player, formname, fields) + if formname ~= "ambience:volume" then + return false + end + minetest.log(dump(fields)) + if fields.quit ~= "true" then + volume[player:get_player_name()].music = tonumber(string.split(fields.music,":")[2]) / 1000 + volume[player:get_player_name()].sound = tonumber(string.split(fields.sound,":")[2]) / 1000 + end + if fields.quit then + local file, err = io.open(world_path.."/ambience_volumes", "w") + if not err then + for item in pairs(volume) do + file:write(item..":"..volume[item].music..":"..volume[item].sound.."\n") + end + file:close() + end + end + return true + end) + +minetest.register_chatcommand( + "svol", + { + params = "", + description = "set volume of sounds, default 1 normal volume.", + privs = {server=true}, + func = function(name, param) + SOUNDVOLUME = param + -- local player = minetest.env:get_player_by_name(name) + -- ambiences = get_ambience(player) + -- stop_sound({}, player) + minetest.chat_send_player(name, "Sound volume set.") + end, + }) + +minetest.register_chatcommand( + "mvol", + { + params = "", + description = "set volume of music, default 1 normal volume.", + privs = {server=true}, + func = function(name, param) + MUSICVOLUME = param + -- local player = minetest.env:get_player_by_name(name) + -- stop_sound({}, player) + -- ambiences = get_ambience(player) + minetest.chat_send_player(name, "Music volume set.") + end, + }) diff --git a/mods/ambience/init.lua.pilz.lua b/mods/ambience/init.lua.pilz.lua new file mode 100644 index 00000000..b1d17962 --- /dev/null +++ b/mods/ambience/init.lua.pilz.lua @@ -0,0 +1,287 @@ +local night = { + handler = {}, + frequency = 10, + {name="horned_owl", length=3}, + {name="Wolves_Howling", length=11}, + {name="ComboWind", length=17}, +} + +local night_frequent = { + handler = {}, + frequency = 25, + {name="Crickets_At_NightCombo", length=69}, +} + +local day = { + handler = {}, + frequency = 5, + {name="Best Cardinal Bird", length=4}, + {name="craw", length=3}, + {name="bluejay", length=18}, + {name="ComboWind", length=17}, +} + +local day_frequent = { + handler = {}, + frequency = 25, + {name="robin2", length=16}, + {name="birdsongnl", length=12.5}, + {name="bird", length=30}, +} + +local cave = { + handler = {}, + frequency = 5, + {name="Bats_in_Cave", length=5}, +} + +local cave_frequent = { + handler = {}, + frequency = 100, + {name="drippingwater_drip_a", length=2}, + {name="drippingwater_drip_b", length=2}, + {name="drippingwater_drip_c", length=2}, + {name="Single_Water_Droplet", length=3}, + {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, + on_stop = "drowning_gasp", + {name="scuba1bubbles", length=11}, + {name="scuba1calm", length=10}, + {name="scuba1calm2", length=8.5}, + {name="scuba1interestingbubbles", length=11}, + {name="scuba1tubulentbubbles", length=10.5}, +} + +local splash = { + handler = {}, + frequency = 100, + {name="Splash", length=1.5}, +} + +local play_music = minetest.setting_getbool("music") or false +local music = { + handler = {}, + frequency = 1, + {name="mtest", length=4*60+33, gain=0.3}, + {name="music_1", length=1*60+52, gain=0.3}, + {name="ambiance", length=19, gain=0.3}, + {name="dark_ambiance", length=46, gain=0.3}, + {name="eastern_feeling", length=3*60+51, gain=0.3}, + {name="echos", length=2*60+26, gain=0.3}, + {name="FoamOfTheSea", length=1*60+50, gain=0.3}, +} + +local is_daytime = function() + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) +end + +local get_ambience = function(player) + local table = {} + + local play_water = false + local play_splash = false + local play_day = false + local play_cave = false + local play_night = false + + 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 + play_water = true + elseif nodename == "air" then + pos.y = pos.y-1.5 + local nodename = minetest.env:get_node(pos).name + if string.find(nodename, "default:water") then + play_splash = true + end + end + if player:getpos().y < 0 then + play_cave = true + elseif is_daytime() then + play_day = true + else + play_night = true + end + + if play_music then + table.music = music + end + if play_water then + table.water = water + table.water_frequent = water_frequent + return table + end + if play_splash then + table.splash = splash + end + if play_day then + table.day = day + table.day_frequent = day_frequent + elseif play_night then + table.night = night + table.night_frequent = night_frequent + elseif play_cave then + table.cave = cave + table.cave_frequent = cave_frequent + end + return table +end + +-- start playing the sound, set the handler and delete the handler after sound is played +local play_sound = function(player, list, number) + local player_name = player:get_player_name() + if list.handler[player_name] == nil then + local gain = 1.0 + if list[number].gain ~= nil then + gain = list[number].gain + end + local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) + if handler ~= nil then + list.handler[player_name] = handler + minetest.after(list[number].length, function(args) + local list = args[1] + local player_name = args[2] + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end, {list, player_name}) + end + end +end + +-- stops all sounds that are not in still_playing +local stop_sound = function(still_playing, player) + local player_name = player:get_player_name() + if still_playing.cave == nil then + local list = cave + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.cave_frequent == nil then + local list = cave_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night == nil then + local list = night + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night_frequent == nil then + local list = night_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day == nil then + local list = day + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day_frequent == nil then + local list = day_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.music == nil then + local list = music + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water == nil then + local list = water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + 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 + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.splash == nil then + local list = splash + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + 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 < 1 then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + local ambiences = get_ambience(player) + stop_sound(ambiences, player) + for _,ambience in pairs(ambiences) do + if math.random(1, 100) <= ambience.frequency then + play_sound(player, ambience, math.random(1, #ambience)) + end + end + end +end) \ No newline at end of file diff --git a/mods/ambience/init16.lua b/mods/ambience/init16.lua new file mode 100644 index 00000000..ba85193e --- /dev/null +++ b/mods/ambience/init16.lua @@ -0,0 +1,439 @@ +-------------------------------------------------------------------------------------------------------- +--Ambiance Configuration for version .16 + +local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000. + +--for frequencies below use a number between 0 and max_frequency_all +--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds +local night_frequency = 20 --owls, wolves +local night_volume = 0.9 +local night_frequent_frequency = 150 --crickets +local night_frequent_volume = 0.9 +local day_frequency = 100 --crow, bluejay, cardinal +local day_volume = 0.9 +local day_frequent_frequency = 1000 --crow, bluejay, cardinal +local day_frequent_volume = 0.18 +local cave_frequency = 10 --bats +local cave_volume = 1.0 +local cave_frequent_frequency = 70 --drops of water dripping +local cave_frequent_volume = 1.0 +local beach_frequency = 20 --seagulls +local beach_volume = 1.0 +local beach_frequent_frequency = 1000 --waves +local beach_frequent_volume = 1.0 +local water_frequent_frequency = 1000 --water sounds +local water_frequent_volume = 1.0 +local music_frequency = 7 --music (suggestion: keep this one low like around 6) +local music_volume = 0.3 +--End of Config +---------------------------------------------------------------------------------------------------- +local played_on_start = false +local night = { + handler = {}, + frequency = night_frequency, + {name="horned_owl", length=3, gain=night_volume}, + {name="Wolves_Howling", length=11, gain=night_volume}, + {name="ComboWind", length=17, gain=night_volume} +} + +local night_frequent = { + handler = {}, + frequency = night_frequent_frequency, + {name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume} +} + +local day = { + handler = {}, + frequency = day_frequency, + {name="Best Cardinal Bird", length=4, gain=day_volume}, + {name="craw", length=3, gain=day_volume}, + {name="bluejay", length=18, gain=day_volume}, + {name="ComboWind", length=17, gain=day_volume} +} + +local day_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="robin2", length=16, gain=day_frequent_volume}, + {name="birdsongnl", length=13, gain=day_frequent_volume}, + {name="bird", length=30, gain=day_frequent_volume}, + {name="Best Cardinal Bird", length=4, gain=day_frequent_volume}, + {name="craw", length=3, gain=day_frequent_volume}, + {name="bluejay", length=18, gain=day_frequent_volume}, + {name="ComboWind", length=17, gain=day_frequent_volume*3} +} + + +local cave = { + handler = {}, + frequency = cave_frequency, + {name="Bats_in_Cave", length=5, gain=cave_volume} +} + +local cave_frequent = { + handler = {}, + frequency = cave_frequent_frequency, + {name="drippingwater_drip_a", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_b", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_c", length=2, gain=cave_frequent_volume}, + {name="Single_Water_Droplet", length=3, gain=cave_frequent_volume}, + {name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume} +} + +local beach = { + handler = {}, + frequency = beach_frequency, + {name="seagull", length=4.5, gain=beach_volume} +} + +local beach_frequent = { + handler = {}, + frequency = beach_frequent_frequency, + {name="fiji_beach", length=43.5, gain=beach_frequent_volume} +} + + +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 = water_frequent_frequency, + on_stop = "drowning_gasp", + on_start = "Splash", + {name="scuba1bubbles", length=11, gain=water_frequent_volume}, + {name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. + {name="scuba1calm2", length=8.5, gain=water_frequent_volume}, + {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume}, + {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume} +} + +local flowing_water = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=14, gain=.4} +} +local flowing_water2 = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=11, gain=.3} +} + +local lava = { + handler = {}, + frequency = 1000, + {name="earth01a", length=20} +} +local lava2 = { + handler = {}, + frequency = 1000, + {name="earth01a", length=15} +} + + +local play_music = minetest.setting_getbool("music") or false +local music = { + handler = {}, + frequency = music_frequency, + {name="mtest", length=4*60+33, gain=music_volume}, + {name="echos", length=2*60+26, gain=music_volume}, + {name="FoamOfTheSea", length=1*60+50, gain=music_volume}, + {name="eastern_feeling", length=3*60+51, gain=music_volume}, + {name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume}, + {name="dark_ambiance", length=44, gain=music_volume} +} + +local is_daytime = function() + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) +end + +--[[old +local nodes_in_range = function(pos, search_distance, node_name) + local search_p = {x=0, y=0, z=0} + local nodes_found = 0 + for p_x=(pos.x-search_distance), (pos.x+search_distance) do + for p_y=(pos.y-search_distance), (pos.y+search_distance) do + for p_z=(pos.z-search_distance), (pos.z+search_distance) do + local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z}) + if search_n.name == node_name then + nodes_found = nodes_found + 1 + end + end + end + end + return nodes_found + --minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")") +end --]] + +local nodes_in_range = function(pos, search_distance, node_name) + minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance} + maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + + +local get_ambience = function(player) + local pos = player:getpos() + pos.y = pos.y+1.0 + 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 nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then + if music then + return {lava=lava, lava2=lava2, music=music} + else + return {lava=lava} + end + end + if nodes_in_range(pos, 7, "default:water_flowing")>5 then + if music then + return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music} + else + return {flowing_water=flowing_water, flowing_water2=flowing_water2} + end + end + pos.y = pos.y-2 + nodename = minetest.env:get_node(pos).name + --minetest.chat_send_all("Found " .. nodename .. pos.y ) + if string.find(nodename, "default:sand") and pos.y < 5 then + if music then + return {beach=beach, beach_frequent=beach_frequent, music=music} + else + return {beach=beach, beach_frequent=beach_frequent} + end + end + if player:getpos().y < 0 then + if music then + return {cave=cave, cave_frequent=cave_frequent, music=music} + else + return {cave=cave, cave_frequent=cave_frequent} + end + end + if is_daytime() then + if music then + return {day=day, day_frequent=day_frequent, music=music} + else + return {day=day, day_frequent=day_frequent} + end + else + if music then + return {night=night, night_frequent=night_frequent, music=music} + else + return {night=night, night_frequent=night_frequent} + end + end +end + +-- start playing the sound, set the handler and delete the handler after sound is played +local play_sound = function(player, list, number) + local player_name = player:get_player_name() + if list.handler[player_name] == nil then + local gain = 1.0 + if list[number].gain ~= nil then + gain = list[number].gain + end + local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) + if handler ~= nil then + list.handler[player_name] = handler + minetest.after(list[number].length, function(args) + local list = args[1] + local player_name = args[2] + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end, {list, player_name}) + end + end +end + +-- stops all sounds that are not in still_playing +local stop_sound = function(still_playing, player) + local player_name = player:get_player_name() + if still_playing.cave == nil then + local list = cave + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.cave_frequent == nil then + local list = cave_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach == nil then + local list = beach + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach_frequent == nil then + local list = beach_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + + if still_playing.night == nil then + local list = night + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night_frequent == nil then + local list = night_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day == nil then + local list = day + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day_frequent == nil then + local list = day_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.music == nil then + local list = music + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water == nil then + local list = flowing_water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water2 == nil then + local list = flowing_water2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava == nil then + local list = lava + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava2 == nil then + local list = lava2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water == nil then + local list = water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + 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 + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + played_on_start = false + end + 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 < 1 then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + local ambiences = get_ambience(player) + stop_sound(ambiences, player) + for _,ambience in pairs(ambiences) do + if math.random(1, 1000) <= ambience.frequency then + if ambience.on_start ~= nil and played_on_start == false then + played_on_start = true + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + end + play_sound(player, ambience, math.random(1, #ambience)) + end + end + end +end) \ No newline at end of file diff --git a/mods/ambience/init17.lua b/mods/ambience/init17.lua new file mode 100644 index 00000000..610bb3bb --- /dev/null +++ b/mods/ambience/init17.lua @@ -0,0 +1,474 @@ +-------------------------------------------------------------------------------------------------------- +--Ambiance Configuration for version .17 + +local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000. + +--for frequencies below use a number between 0 and max_frequency_all +--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds +local night_frequency = 20 --owls, wolves +local night_volume = 0.9 +local night_frequent_frequency = 150 --crickets +local night_frequent_volume = 0.9 +local day_frequency = 100 --crow, bluejay, cardinal +local day_volume = 0.9 +local day_frequent_frequency = 1000 --crow, bluejay, cardinal +local day_frequent_volume = 0.18 +local cave_frequency = 10 --bats +local cave_volume = 1.0 +local cave_frequent_frequency = 70 --drops of water dripping +local cave_frequent_volume = 1.0 +local beach_frequency = 20 --seagulls +local beach_volume = 1.0 +local beach_frequent_frequency = 1000 --waves +local beach_frequent_volume = 1.0 +local water_frequent_frequency = 1000 --water sounds +local water_frequent_volume = 1.0 +local music_frequency = 0 --music (suggestion: keep this one low like around 6) +local music_volume = 0.3 +--End of Config +---------------------------------------------------------------------------------------------------- +local played_on_start = false +local night = { + handler = {}, + frequency = night_frequency, + {name="horned_owl", length=3, gain=night_volume}, + {name="Wolves_Howling", length=11, gain=night_volume}, + {name="ComboWind", length=17, gain=night_volume} +} + +local night_frequent = { + handler = {}, + frequency = night_frequent_frequency, + {name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume} +} + +local day = { + handler = {}, + frequency = day_frequency, + {name="Best Cardinal Bird", length=4, gain=day_volume}, + {name="craw", length=3, gain=day_volume}, + {name="bluejay", length=18, gain=day_volume}, + {name="ComboWind", length=17, gain=day_volume} +} + +local day_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="robin2", length=16, gain=day_frequent_volume}, + {name="birdsongnl", length=13, gain=day_frequent_volume}, + {name="bird", length=30, gain=day_frequent_volume}, + {name="Best Cardinal Bird", length=4, gain=day_frequent_volume}, + {name="craw", length=3, gain=day_frequent_volume}, + {name="bluejay", length=18, gain=day_frequent_volume}, + {name="ComboWind", length=17, gain=day_frequent_volume*3} +} + + +local cave = { + handler = {}, + frequency = cave_frequency, + {name="Bats_in_Cave", length=5, gain=cave_volume} +} + +local cave_frequent = { + handler = {}, + frequency = cave_frequent_frequency, + {name="drippingwater_drip_a", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_b", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_c", length=2, gain=cave_frequent_volume}, + {name="Single_Water_Droplet", length=3, gain=cave_frequent_volume}, + {name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume} +} + +local beach = { + handler = {}, + frequency = beach_frequency, + {name="seagull", length=4.5, gain=beach_volume} +} + +local beach_frequent = { + handler = {}, + frequency = beach_frequent_frequency, + {name="fiji_beach", length=43.5, gain=beach_frequent_volume} +} + + +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 = water_frequent_frequency, + on_stop = "drowning_gasp", + on_start = "Splash", + {name="scuba1bubbles", length=11, gain=water_frequent_volume}, + {name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. + {name="scuba1calm2", length=8.5, gain=water_frequent_volume}, + {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume}, + {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume} +} + +local water_surface = { + handler = {}, + frequency = 10, + on_start = "Splash", + {name="lake_waves_2_calm", length=9.5}, + {name="lake_waves_2_variety", length=13.1} +} + +local flowing_water = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=14, gain=.4} +} +local flowing_water2 = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=11, gain=.3} +} + +local lava = { + handler = {}, + frequency = 1000, + {name="earth01a", length=20} +} +local lava2 = { + handler = {}, + frequency = 1000, + {name="earth01a", length=15} +} + + +local play_music = minetest.setting_getbool("music") or false +local music = { + handler = {}, + frequency = music_frequency, + {name="mtest", length=4*60+33, gain=music_volume}, + {name="echos", length=2*60+26, gain=music_volume}, + {name="FoamOfTheSea", length=1*60+50, gain=music_volume}, + {name="eastern_feeling", length=3*60+51, gain=music_volume}, + {name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume}, + {name="dark_ambiance", length=44, gain=music_volume} +} + +local is_daytime = function() + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) +end + +--[[old +local nodes_in_range = function(pos, search_distance, node_name) + local search_p = {x=0, y=0, z=0} + local nodes_found = 0 + for p_x=(pos.x-search_distance), (pos.x+search_distance) do + for p_y=(pos.y-search_distance), (pos.y+search_distance) do + for p_z=(pos.z-search_distance), (pos.z+search_distance) do + local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z}) + if search_n.name == node_name then + nodes_found = nodes_found + 1 + end + end + end + end + return nodes_found + --minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")") +end --]] + +local nodes_in_range = function(pos, search_distance, node_name) + minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance} + maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + + +local get_ambience = function(player) + local pos = player:getpos() + pos.y = pos.y+1.0 + 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 + elseif nodename == "air" then + pos.y = pos.y-1.5 + local nodename = minetest.env:get_node(pos).name + pos.y = pos.y+1.5 + if string.find(nodename, "default:water") then + if music then + return {water_surface=water_surface, music=music} + else + return {water_surface} + end + end + end + + if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then + if music then + return {lava=lava, lava2=lava2, music=music} + else + return {lava=lava} + end + end + if nodes_in_range(pos, 7, "default:water_flowing")>5 then + if music then + return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music} + else + return {flowing_water=flowing_water, flowing_water2=flowing_water2} + end + end + pos.y = pos.y-2 + nodename = minetest.env:get_node(pos).name + --minetest.chat_send_all("Found " .. nodename .. pos.y ) + if string.find(nodename, "default:sand") and pos.y < 5 then + if music then + return {beach=beach, beach_frequent=beach_frequent, music=music} + else + return {beach=beach, beach_frequent=beach_frequent} + end + end + if player:getpos().y < 0 then + if music then + return {cave=cave, cave_frequent=cave_frequent, music=music} + else + return {cave=cave, cave_frequent=cave_frequent} + end + end + if is_daytime() then + if music then + return {day=day, day_frequent=day_frequent, music=music} + else + return {day=day, day_frequent=day_frequent} + end + else + if music then + return {night=night, night_frequent=night_frequent, music=music} + else + return {night=night, night_frequent=night_frequent} + end + end +end + +-- start playing the sound, set the handler and delete the handler after sound is played +local play_sound = function(player, list, number) + local player_name = player:get_player_name() + if list.handler[player_name] == nil then + local gain = 1.0 + if list[number].gain ~= nil then + gain = list[number].gain + end + local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) + if handler ~= nil then + list.handler[player_name] = handler + minetest.after(list[number].length, function(args) + local list = args[1] + local player_name = args[2] + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end, {list, player_name}) + end + end +end + +-- stops all sounds that are not in still_playing +local stop_sound = function(still_playing, player) + local player_name = player:get_player_name() + if still_playing.cave == nil then + local list = cave + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.cave_frequent == nil then + local list = cave_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach == nil then + local list = beach + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach_frequent == nil then + local list = beach_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + + if still_playing.night == nil then + local list = night + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night_frequent == nil then + local list = night_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day == nil then + local list = day + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day_frequent == nil then + local list = day_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.music == nil then + local list = music + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water == nil then + local list = flowing_water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water2 == nil then + local list = flowing_water2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava == nil then + local list = lava + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava2 == nil then + local list = lava2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water == nil then + local list = water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water_surface == nil then + local list = water_surface + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + played_on_start = false + end + 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 + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.chat_send_all("list.on_stop " .. list.on_stop ) + -- played_on_start = false + end + 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 < 1 then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + local ambiences = get_ambience(player) + stop_sound(ambiences, player) + for _,ambience in pairs(ambiences) do + if math.random(1, 1000) <= ambience.frequency then + if ambience.on_start ~= nil and played_on_start == false then + played_on_start = true + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + end + play_sound(player, ambience, math.random(1, #ambience)) + end + end + end +end) \ No newline at end of file diff --git a/mods/ambience/init29debug.lua b/mods/ambience/init29debug.lua new file mode 100644 index 00000000..60bf38f5 --- /dev/null +++ b/mods/ambience/init29debug.lua @@ -0,0 +1,722 @@ +-------------------------------------------------------------------------------------------------------- +--Ambiance Configuration for version .29 +--working on Flying +--PROB: wind stops short even though it says we are still flying and don't hear the start sound. +--really BIG prob, it ruins water meaning you hear beach while treading water. (find out if still hear it in .28) because +--it is fairly rare in .29 +--need a separate onstart variable for flying + + +local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000. + +--for frequencies below use a number between 0 and max_frequency_all +--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds +local night_frequency = 20 --owls, wolves +local night_volume = 0.9 +local night_frequent_frequency = 150 --crickets +local night_frequent_volume = 0.9 +local day_frequency = 100 --crow, bluejay, cardinal +local day_volume = 0.9 +local day_frequent_frequency = 1000 --crow, bluejay, cardinal +local day_frequent_volume = 0.18 +local cave_frequency = 10 --bats +local cave_volume = 1.0 +local cave_frequent_frequency = 70 --drops of water dripping +local cave_frequent_volume = 1.0 +local beach_frequency = 20 --seagulls +local beach_volume = 1.0 +local beach_frequent_frequency = 1000 --waves +local beach_frequent_volume = 1.0 +local water_frequent_frequency = 1000 --water sounds +local water_frequent_volume = 1.0 +local desert_frequency = 20 --coyote +local desert_volume = 1.0 +local desert_frequent_frequency = 700 --desertwind +local desert_frequent_volume = 1.0 +local swimming_frequent_frequency = 1000 --swimming splashes +local swimming_frequent_volume = 1.0 +local music_frequency = 0 --music (suggestion: keep this one low like around 6) +local music_volume = 0.3 +--End of Config +---------------------------------------------------------------------------------------------------- +local counter=0--***************** +local last_x_pos = 0 +local last_y_pos = 0 +local last_z_pos = 0 +local node_under_feet +local node_at_upper_body +local node_at_lower_body +local node_3_under_feet + +local played_on_start = false +local played_on_start_flying = false + +local night = { + handler = {}, + frequency = night_frequency, + {name="horned_owl", length=3, gain=night_volume}, + {name="Wolves_Howling", length=11, gain=night_volume}, + {name="ComboWind", length=17, gain=night_volume} +} + +local night_frequent = { + handler = {}, + frequency = night_frequent_frequency, + {name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume} +} + +local day = { + handler = {}, + frequency = day_frequency, + {name="Best Cardinal Bird", length=4, gain=day_volume}, + {name="craw", length=3, gain=day_volume}, + {name="bluejay", length=18, gain=day_volume}, + {name="ComboWind", length=17, gain=day_volume} +} + +local day_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="robin2", length=16, gain=day_frequent_volume}, + {name="birdsongnl", length=13, gain=day_frequent_volume}, + {name="bird", length=30, gain=day_frequent_volume}, + {name="Best Cardinal Bird", length=4, gain=day_frequent_volume}, + {name="craw", length=3, gain=day_frequent_volume}, + {name="bluejay", length=18, gain=day_frequent_volume}, + {name="ComboWind", length=17, gain=day_frequent_volume*3} +} +local swimming_frequent = { + handler = {}, + frequency = day_frequent_frequency, + {name="water_swimming_splashing_breath", length=11.5, gain=swimming_frequent_volume}, + {name="water_swimming_splashing", length=9, gain=swimming_frequent_volume} +} + +local cave = { + handler = {}, + frequency = cave_frequency, + {name="Bats_in_Cave", length=5, gain=cave_volume} +} + +local cave_frequent = { + handler = {}, + frequency = cave_frequent_frequency, + {name="drippingwater_drip_a", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_b", length=2, gain=cave_frequent_volume}, + {name="drippingwater_drip_c", length=2, gain=cave_frequent_volume}, + {name="Single_Water_Droplet", length=3, gain=cave_frequent_volume}, + {name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume} +} + +local beach = { + handler = {}, + frequency = beach_frequency, + {name="seagull", length=4.5, gain=beach_volume} +} + +local beach_frequent = { + handler = {}, + frequency = beach_frequent_frequency, + {name="fiji_beach", length=43.5, gain=beach_frequent_volume} +} + +local desert = { + handler = {}, + frequency = desert_frequency, + {name="coyote2", length=2.5, gain=desert_volume}, + {name="RattleSnake", length=8, gain=desert_volume} +} + +local desert_frequent = { + handler = {}, + frequency = desert_frequent_frequency, + {name="DesertMonolithMed", length=34.5, gain=desert_frequent_volume} +} + +local flying = { + handler = {}, + frequency = 1000, + on_start = "crystal_airlines", + on_stop = "nothing_yet", + {name="ComboWind", length=17, gain=1} +} + +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 = water_frequent_frequency, + on_stop = "drowning_gasp", + --on_start = "Splash", + {name="scuba1bubbles", length=11, gain=water_frequent_volume}, + {name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. + {name="scuba1calm2", length=8.5, gain=water_frequent_volume}, + {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume}, + {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume} +} + +local water_surface = { + handler = {}, + frequency = 1000, + on_stop = "Splash", + on_start = "Splash", + {name="lake_waves_2_calm", length=9.5}, + {name="lake_waves_2_variety", length=13.1} +} +local splashing_water = { + handler = {}, + frequency = 1000, + {name="Splash", length=1.22, gain=1} +} + +local flowing_water = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=14, gain=.4} +} +local flowing_water2 = { + handler = {}, + frequency = 1000, + {name="small_waterfall", length=11, gain=.3} +} + +local lava = { + handler = {}, + frequency = 1000, + {name="earth01a", length=20} +} +local lava2 = { + handler = {}, + frequency = 1000, + {name="earth01a", length=15} +} + + +local play_music = minetest.setting_getbool("music") or false +local music = { + handler = {}, + frequency = music_frequency, + {name="mtest", length=4*60+33, gain=music_volume}, + {name="echos", length=2*60+26, gain=music_volume}, + {name="FoamOfTheSea", length=1*60+50, gain=music_volume}, + {name="eastern_feeling", length=3*60+51, gain=music_volume}, + {name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume}, + {name="dark_ambiance", length=44, gain=music_volume} +} + +local is_daytime = function() + return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8) +end + +local nodes_in_range = function(pos, search_distance, node_name) + minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance} + maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) + --minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + +local nodes_in_coords = function(minp, maxp, node_name) + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) + --minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")") + return #nodes +end + +local atleast_nodes_in_grid = function(pos, search_distance, height, node_name, threshold) +-- counter = counter +1 +-- minetest.chat_send_all("counter: (" .. counter .. ")") + minp = {x=pos.x-search_distance,y=height, z=pos.z+20} + maxp = {x=pos.x+search_distance,y=height, z=pos.z+20} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("z+Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + totalnodes = #nodes + minp = {x=pos.x-search_distance,y=height, z=pos.z-20} + maxp = {x=pos.x+search_distance,y=height, z=pos.z-20} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("z-Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + totalnodes = totalnodes + #nodes + maxp = {x=pos.x+20,y=height, z=pos.z+search_distance} + minp = {x=pos.x+20,y=height, z=pos.z-search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + totalnodes = totalnodes + #nodes + maxp = {x=pos.x-20,y=height, z=pos.z+search_distance} + minp = {x=pos.x-20,y=height, z=pos.z-search_distance} + nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name) +-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")") + if #nodes >= threshold then + return true + end + totalnodes = totalnodes + #nodes +-- minetest.chat_send_all("Found total(" .. totalnodes .. ")") + if totalnodes >= threshold*2 then + return true + end + return false +end + +local get_immediate_nodes = function(pos) + pos.y = pos.y-1 + node_under_feet = minetest.env:get_node(pos).name + pos.y = pos.y-3 + node_3_under_feet = minetest.env:get_node(pos).name + pos.y = pos.y+3 + pos.y = pos.y+2.2 + node_at_upper_body = minetest.env:get_node(pos).name + pos.y = pos.y-1.19 + node_at_lower_body = minetest.env:get_node(pos).name + pos.y = pos.y+0.99 --1.6 + --minetest.chat_send_all("node_under_feet(" .. nodename .. ")") +end + + +local get_ambience = function(player) + local player_is_climbing = false + local player_is_descending = false + local player_is_moving_horiz = false + local standing_in_water = false + local pos = player:getpos() + get_immediate_nodes(pos) + + if last_x_pos ~=pos.x or last_z_pos ~=pos.z then + player_is_moving_horiz = true + end + if pos.y > last_y_pos+.5 then + player_is_climbing = true + end + if pos.y < last_y_pos-.5 then + player_is_descending = true + end + + last_x_pos =pos.x + last_z_pos =pos.z + last_y_pos =pos.y + + if string.find(node_at_upper_body, "default:water") then + if music then + return {water=water, water_frequent=water_frequent, music=music} + else + return {water=water, water_frequent=water_frequent} + end + elseif node_at_upper_body == "air" then + if string.find(node_at_lower_body, "default:water") then + --minetest.chat_send_all("bottom counted as water") + --we found air at upperbody, and water at lower body. Now there are 4 possibilities: + --Key: under feet, moving or not + --swimming w, m swimming + --walking in water nw, m splashing + --treading water w, nm sloshing + --standing in water nw, nm beach trumps, then sloshing + if player_is_moving_horiz then + if string.find(node_under_feet, "default:water") then + if music then + return {swimming_frequent=swimming_frequent, music=music} + else + return {swimming_frequent} + end + else --didn't find water under feet: walking in water + if music then + return {splashing_water=splashing_water, music=music} + else + return {splashing_water} + end + end + else--player is not moving + if string.find(node_under_feet, "default:water") then + if music then + return {water_surface=water_surface, music=music} + else + return {water_surface} + end + else --didn't find water under feet + standing_in_water = true + end + end + end + end + if player_is_moving_horiz then + minetest.chat_send_all("playermoving") + end + if player_is_climbing then + minetest.chat_send_all("player Climbing") + end + minetest.chat_send_all("nub:" ..node_at_upper_body) + minetest.chat_send_all("nlb:" ..node_at_lower_body) + minetest.chat_send_all("nuf:" ..node_under_feet) + minetest.chat_send_all("n3uf:" ..node_3_under_feet) + + local air_or_ignore = {air=true,ignore=true} + --minetest.chat_send_all(air_or_ignore[node_under_feet]) + if (player_is_moving_horiz or player_is_climbing) and air_or_ignore[node_at_upper_body] and air_or_ignore[node_at_lower_body] + and air_or_ignore[node_under_feet] and air_or_ignore[node_3_under_feet] and not player_is_descending then + minetest.chat_send_all("flying!!!!") + if music then + return {flying=flying, music=music} + else + return {flying} + end + end + minetest.chat_send_all("not flying!!!!") + + if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then + if music then + return {lava=lava, lava2=lava2, music=music} + else + return {lava=lava} + end + end + if nodes_in_range(pos, 6, "default:water_flowing")>45 then + if music then + return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music} + else + return {flowing_water=flowing_water, flowing_water2=flowing_water2} + end + end + + +--if we are near sea level and there is lots of water around the area + if pos.y < 7 and pos.y >0 and atleast_nodes_in_grid(pos, 60, 1, "default:water_source", 51 ) then + if music then + return {beach=beach, beach_frequent=beach_frequent, music=music} + else + return {beach=beach, beach_frequent=beach_frequent} + end + end + if standing_in_water then + if music then + return {water_surface=water_surface, music=music} + else + return {water_surface} + end + end + + + desert_in_range = (nodes_in_range(pos, 6, "default:desert_sand")+nodes_in_range(pos, 6, "default:desert_stone")) + --minetest.chat_send_all("desertcount: " .. desert_in_range .. ",".. pos.y ) + if desert_in_range >250 then + if music then + return {desert=desert, desert_frequent=desert_frequent, music=music} + else + return {desert=desert, desert_frequent=desert_frequent} + end + end + + pos.y = pos.y-2 + nodename = minetest.env:get_node(pos).name +-- minetest.chat_send_all("Found " .. nodename .. pos.y ) + + + if player:getpos().y < 0 then + if music then + return {cave=cave, cave_frequent=cave_frequent, music=music} + else + return {cave=cave, cave_frequent=cave_frequent} + end + end + if is_daytime() then + if music then + return {day=day, day_frequent=day_frequent, music=music} + else + return {day=day, day_frequent=day_frequent} + end + else + if music then + return {night=night, night_frequent=night_frequent, music=music} + else + return {night=night, night_frequent=night_frequent} + end + end +end + +-- start playing the sound, set the handler and delete the handler after sound is played +local play_sound = function(player, list, number) + local player_name = player:get_player_name() + if list.handler[player_name] == nil then + local gain = 1.0 + if list[number].gain ~= nil then + gain = list[number].gain + end + local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) + if handler ~= nil then + list.handler[player_name] = handler + minetest.after(list[number].length, function(args) + local list = args[1] + local player_name = args[2] + if list.handler[player_name] ~= nil then + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end, {list, player_name}) + end + end +end + +-- stops all sounds that are not in still_playing +local stop_sound = function(still_playing, player) + local player_name = player:get_player_name() + if still_playing.cave == nil then + local list = cave + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.cave_frequent == nil then + local list = cave_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.swimming_frequent == nil then + local list = swimming_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach == nil then + local list = beach + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.beach_frequent == nil then + local list = beach_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.desert == nil then + local list = desert + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.desert_frequent == nil then + local list = desert_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night == nil then + local list = night + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.night_frequent == nil then + local list = night_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day == nil then + local list = day + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.day_frequent == nil then + local list = day_frequent + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.music == nil then + local list = music + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water == nil then + local list = flowing_water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flowing_water2 == nil then + local list = flowing_water2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava == nil then + local list = lava + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.lava2 == nil then + local list = lava2 + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water == nil then + local list = water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.water_surface == nil then + local list = water_surface + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + played_on_start = false + end + 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 + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + -- minetest.chat_send_all("list.on_stop " .. list.on_stop ) + played_on_start = false + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.flying == nil then + --minetest.chat_send_all("begin stop flying " ) + local list = flying + if list.handler[player_name] ~= nil then + -- minetest.chat_send_all("handler flying " ) + if list.on_stop ~= nil then + -- minetest.chat_send_all("onstop flying" ) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + played_on_start = false + end + minetest.sound_stop(list.handler[player_name]) + list.handler[player_name] = nil + end + end + if still_playing.splashing_water == nil then + local list = splashing_water + if list.handler[player_name] ~= nil then + if list.on_stop ~= nil then + minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + end + 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 < 1 then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + local ambiences = get_ambience(player) + stop_sound(ambiences, player) + for _,ambience in pairs(ambiences) do + if math.random(1, 1000) <= ambience.frequency then + if(played_on_start) then + -- minetest.chat_send_all("playedOnStart " ) + else + -- minetest.chat_send_all("FALSEplayedOnStart " ) + end + if ambience.on_start ~= nil and played_on_start == false then + played_on_start = true + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + end + minetest.chat_send_all("ambience: " ..ambience ) + -- if ambience.on_start ~= nil and played_on_start_flying == false then + -- played_on_start_flying = true + -- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + -- end + play_sound(player, ambience, math.random(1, #ambience)) + end + end + end +end) \ No newline at end of file diff --git a/mods/music/sounds/Ambivalent.ogg b/mods/ambience/sounds/Ambivalent.ogg similarity index 100% rename from mods/music/sounds/Ambivalent.ogg rename to mods/ambience/sounds/Ambivalent.ogg diff --git a/mods/ambience/sounds/AvalonShort.ogg b/mods/ambience/sounds/AvalonShort.ogg new file mode 100644 index 00000000..fcb1277b Binary files /dev/null and b/mods/ambience/sounds/AvalonShort.ogg differ diff --git a/mods/ambience/sounds/Bats_in_Cave.ogg b/mods/ambience/sounds/Bats_in_Cave.ogg new file mode 100644 index 00000000..97662d0e Binary files /dev/null and b/mods/ambience/sounds/Bats_in_Cave.ogg differ diff --git a/mods/ambience/sounds/Best Cardinal Bird.ogg b/mods/ambience/sounds/Best Cardinal Bird.ogg new file mode 100644 index 00000000..4a933954 Binary files /dev/null and b/mods/ambience/sounds/Best Cardinal Bird.ogg differ diff --git a/mods/ambience/sounds/ComboWind.ogg b/mods/ambience/sounds/ComboWind.ogg new file mode 100644 index 00000000..dfee1baf Binary files /dev/null and b/mods/ambience/sounds/ComboWind.ogg differ diff --git a/mods/ambience/sounds/Crickets_At_NightCombo.ogg b/mods/ambience/sounds/Crickets_At_NightCombo.ogg new file mode 100644 index 00000000..d0df3276 Binary files /dev/null and b/mods/ambience/sounds/Crickets_At_NightCombo.ogg differ diff --git a/mods/ambience/sounds/DesertMonolithMed.ogg b/mods/ambience/sounds/DesertMonolithMed.ogg new file mode 100644 index 00000000..93757b15 Binary files /dev/null and b/mods/ambience/sounds/DesertMonolithMed.ogg differ diff --git a/mods/ambience/sounds/EtherealShort.ogg b/mods/ambience/sounds/EtherealShort.ogg new file mode 100644 index 00000000..fadc9229 Binary files /dev/null and b/mods/ambience/sounds/EtherealShort.ogg differ diff --git a/mods/ambience/sounds/FarawayShort.ogg b/mods/ambience/sounds/FarawayShort.ogg new file mode 100644 index 00000000..31237b7d Binary files /dev/null and b/mods/ambience/sounds/FarawayShort.ogg differ diff --git a/mods/ambience/sounds/RattleSnake.ogg b/mods/ambience/sounds/RattleSnake.ogg new file mode 100644 index 00000000..6cebf02e Binary files /dev/null and b/mods/ambience/sounds/RattleSnake.ogg differ diff --git a/mods/ambience/sounds/Single_Water_Droplet.ogg b/mods/ambience/sounds/Single_Water_Droplet.ogg new file mode 100644 index 00000000..b7324534 Binary files /dev/null and b/mods/ambience/sounds/Single_Water_Droplet.ogg differ diff --git a/mods/ambience/sounds/SoundLicenses.txt b/mods/ambience/sounds/SoundLicenses.txt old mode 100755 new mode 100644 index 7bee6c63..f37a799e --- a/mods/ambience/sounds/SoundLicenses.txt +++ b/mods/ambience/sounds/SoundLicenses.txt @@ -1,118 +1,115 @@ ---------------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 ---Crickets At Night Sound, License: Attribution 3.0 | Recorded by Mike Koenig |http://soundbible.com/365-Crickets-At-Night.html - ---Medium Pack Of Wolves Howling, License: Public Domain | Recorded by fws.gov, http://soundbible.com/277-Medium-Pack-Of-Wolves-Howling.html - ---Horned Owl Sound, License: Attribution 3.0 | Recorded by Mike Koenig , http://soundbible.com/1851-Horned-Owl.html ---Bats In Cave Sound, License: Attr-Noncommercial 3.0 | Recorded by Mike Koenig , http://soundbible.com/1939-Bats-In-Cave.html - ---Spooky Water Drops Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/380-Spooky-Water-Drops.html - - --- Single Water Droplet Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/384-Single-Water-Droplet.html - ---HollowWind, Black Boe, Creative Commons 0 License, http://www.freesound.org/people/Black%20Boe/sounds/22331/ - ---drippingwater*.ogg sounds: CC0, Dripping Water Mod, by kddekadenz, http://minetest.net/forum/viewtopic.php?id=1688 - ---best cardinal bird: License: Attribution 3.0 | Recorded by PsychoBird, http://soundbible.com/1515-Best-Cardinal-Bird.html - ---birdsongnl: the Attribution License, HerbertBoland, http://www.freesound.org/people/HerbertBoland/sounds/28312/ (end) - ---robin2: Attribution License, reinsamba, http://www.freesound.org/people/reinsamba/sounds/32479/ (end) - ---Craw.WAV, Attribution License, inchadney, http://www.freesound.org/people/inchadney/sounds/52450/ - ---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/ - -ComboWind uses: ---wind-in-the-trees -Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/16995/ ---drygrassInWind- Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/146436/ - ---Splash: Attribution 3.0 | Recorded by BlastwaveFx.com, http://soundbible.com/546-Fish-Splashing.html - ---small_waterfall Attribution License, volivieri, http://www.freesound.org/people/volivieri/sounds/38390/ - ---Lake_Waves_2*, Attribution License, Benboncan, http://www.freesound.org/people/Benboncan/sounds/67884/ - ---water_swimming_splashing*, Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/ - ---earth01a, Creative Commons 0 License., Halion , http://www.freesound.org/people/Halion/sounds/17785 - ---fiji_beach, Creative Commons 0 License, c97059890, http://www.freesound.org/people/c97059890/sounds/21754/ - ---seagull, Attribution Noncommercial License., hazure, http://www.freesound.org/people/hazure/sounds/23707/, - -desert: -coyote2, Attribution License, rogerforeman, http://www.freesound.org/people/rogerforeman/sounds/68068/ -http://www.freesound.org/people/Proxima4/sounds/104319/ -Desert Monolith.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104319/ -Rattlesnake Rattle, Public Domain, fws.gov, http://soundbible.com/237-Rattlesnake-Rattle.html - -flying: -crystal_airlines: Attribution License, suonho, http://www.freesound.org/people/suonho/sounds/56364/ - -----------------Not used yet: -desert: -Desert Simple.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104320/ - - 313hummer (Jordan Craige) ---echos http://soundcloud.com/jordan-craige/echos-1 -Creative Commons Attribution license (reuse allowed) Attribution 3.0 Unported (CC BY 3.0) -Not Used:--FoamOfTheSea http://soundcloud.com/jordan-craige/foam-of-the-sea - -xi-intersection: -http://soundcloud.com/xi-intersection/mass-effect-uncharted-worlds Creative Commons License ---not used: -http://soundcloud.com/xi-intersection/donkey-kong-country-2-flight -http://soundcloud.com/kogyo/kogyo-skalar-m1 - -lava: -http://www.freesound.org/people/Halion/sounds/17785/ (almost as good cc) (combine with rocks falling?) -http://www.freesound.org/people/pushtobreak/sounds/17823/ (attrib non cc really good) -http://www.freesound.org/people/klankbeeld/sounds/123970/ (horror rhythm) -Rockfall in mine.wav http://www.freesound.org/people/Benboncan/sounds/60085/ - - -http://www.freesound.org/people/snotch/sounds/96175/ (mud volcano) - ---natural night sounds in Boquete.wav, Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/15851/ -http://www.freesound.org/people/Dynamicell/sounds/17553/ -http://www.freesound.org/people/juskiddink/sounds/78955/ aspen tree in wind -http://www.freesound.org/people/Benboncan/sounds/69761/ wind in hedge birds animals - - -ButterflyTea: -Creative Commons : Attribution-Noncommercial-Share Alike 3.0 -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 - -zero-project +--------------Music Lic: +Amethystium: +--Avalon +--Ethereal +--Faraway +--Strangely Beautiful +Used with kind permission from Øystein Ramfjord / AM.mu Records + +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 +--Crickets At Night Sound, License: Attribution 3.0 | Recorded by Mike Koenig |http://soundbible.com/365-Crickets-At-Night.html + +--Medium Pack Of Wolves Howling, License: Public Domain | Recorded by fws.gov, http://soundbible.com/277-Medium-Pack-Of-Wolves-Howling.html + +--Horned Owl Sound, License: Attribution 3.0 | Recorded by Mike Koenig , http://soundbible.com/1851-Horned-Owl.html +--Bats In Cave Sound, License: Attr-Noncommercial 3.0 | Recorded by Mike Koenig , http://soundbible.com/1939-Bats-In-Cave.html + +--Spooky Water Drops Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/380-Spooky-Water-Drops.html + + +-- Single Water Droplet Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/384-Single-Water-Droplet.html + +--HollowWind, Black Boe, Creative Commons 0 License, http://www.freesound.org/people/Black%20Boe/sounds/22331/ + +--drippingwater*.ogg sounds: CC0, Dripping Water Mod, by kddekadenz, http://minetest.net/forum/viewtopic.php?id=1688 + +--best cardinal bird: License: Attribution 3.0 | Recorded by PsychoBird, http://soundbible.com/1515-Best-Cardinal-Bird.html + +--birdsongnl: the Attribution License, HerbertBoland, http://www.freesound.org/people/HerbertBoland/sounds/28312/ (end) + +--robin2: Attribution License, reinsamba, http://www.freesound.org/people/reinsamba/sounds/32479/ (end) + +--Craw.WAV, Attribution License, inchadney, http://www.freesound.org/people/inchadney/sounds/52450/ + +--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/ + +ComboWind uses: +--wind-in-the-trees -Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/16995/ +--drygrassInWind- Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/146436/ + +--Splash: Attribution 3.0 | Recorded by BlastwaveFx.com, http://soundbible.com/546-Fish-Splashing.html + +--small_waterfall Attribution License, volivieri, http://www.freesound.org/people/volivieri/sounds/38390/ + +--Lake_Waves_2*, Attribution License, Benboncan, http://www.freesound.org/people/Benboncan/sounds/67884/ + +--water_swimming_splashing*, Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/ + +--earth01a, Creative Commons 0 License., Halion , http://www.freesound.org/people/Halion/sounds/17785 + +--fiji_beach, Creative Commons 0 License, c97059890, http://www.freesound.org/people/c97059890/sounds/21754/ + +--seagull, Attribution Noncommercial License., hazure, http://www.freesound.org/people/hazure/sounds/23707/, + +desert: +coyote2, Attribution License, rogerforeman, http://www.freesound.org/people/rogerforeman/sounds/68068/ +http://www.freesound.org/people/Proxima4/sounds/104319/ +Desert Monolith.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104319/ +Rattlesnake Rattle, Public Domain, fws.gov, http://soundbible.com/237-Rattlesnake-Rattle.html + +flying: +crystal_airlines: Attribution License, suonho, http://www.freesound.org/people/suonho/sounds/56364/ + +----------------Not used yet: +desert: +Desert Simple.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104320/ + + 313hummer (Jordan Craige) +--echos http://soundcloud.com/jordan-craige/echos-1 +Creative Commons Attribution license (reuse allowed) Attribution 3.0 Unported (CC BY 3.0) +Not Used:--FoamOfTheSea http://soundcloud.com/jordan-craige/foam-of-the-sea + +xi-intersection: +http://soundcloud.com/xi-intersection/mass-effect-uncharted-worlds Creative Commons License +--not used: +http://soundcloud.com/xi-intersection/donkey-kong-country-2-flight +http://soundcloud.com/kogyo/kogyo-skalar-m1 + +lava: +http://www.freesound.org/people/Halion/sounds/17785/ (almost as good cc) (combine with rocks falling?) +http://www.freesound.org/people/pushtobreak/sounds/17823/ (attrib non cc really good) +http://www.freesound.org/people/klankbeeld/sounds/123970/ (horror rhythm) +Rockfall in mine.wav http://www.freesound.org/people/Benboncan/sounds/60085/ + + +http://www.freesound.org/people/snotch/sounds/96175/ (mud volcano) + +--natural night sounds in Boquete.wav, Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/15851/ +http://www.freesound.org/people/Dynamicell/sounds/17553/ +http://www.freesound.org/people/juskiddink/sounds/78955/ aspen tree in wind +http://www.freesound.org/people/Benboncan/sounds/69761/ wind in hedge birds animals + + +ButterflyTea: +Creative Commons : Attribution-Noncommercial-Share Alike 3.0 +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 + +zero-project diff --git a/mods/ambience/sounds/Splash.ogg b/mods/ambience/sounds/Splash.ogg new file mode 100644 index 00000000..8a433a71 Binary files /dev/null and b/mods/ambience/sounds/Splash.ogg differ diff --git a/mods/ambience/sounds/Spooky_Water_Drops.ogg b/mods/ambience/sounds/Spooky_Water_Drops.ogg new file mode 100644 index 00000000..c2a3be98 Binary files /dev/null and b/mods/ambience/sounds/Spooky_Water_Drops.ogg differ diff --git a/mods/ambience/sounds/StrangelyBeautifulShort.ogg b/mods/ambience/sounds/StrangelyBeautifulShort.ogg new file mode 100644 index 00000000..1623f092 Binary files /dev/null and b/mods/ambience/sounds/StrangelyBeautifulShort.ogg differ diff --git a/mods/ambience/sounds/Wolves_Howling.ogg b/mods/ambience/sounds/Wolves_Howling.ogg new file mode 100644 index 00000000..537d0579 Binary files /dev/null and b/mods/ambience/sounds/Wolves_Howling.ogg differ diff --git a/mods/ambience/sounds/anonnp4014.ogg b/mods/ambience/sounds/anonnp4014.ogg new file mode 100644 index 00000000..d6f25eee Binary files /dev/null and b/mods/ambience/sounds/anonnp4014.ogg differ diff --git a/mods/ambience/sounds/beach.ogg b/mods/ambience/sounds/beach.ogg deleted file mode 100755 index 69c37b7d..00000000 Binary files a/mods/ambience/sounds/beach.ogg and /dev/null differ diff --git a/mods/ambience/sounds/bensound_deepblue.ogg b/mods/ambience/sounds/bensound_deepblue.ogg new file mode 100644 index 00000000..b3940515 Binary files /dev/null and b/mods/ambience/sounds/bensound_deepblue.ogg differ diff --git a/mods/ambience/sounds/bensound_ofeliasdream.ogg b/mods/ambience/sounds/bensound_ofeliasdream.ogg new file mode 100644 index 00000000..1d975767 Binary files /dev/null and b/mods/ambience/sounds/bensound_ofeliasdream.ogg differ diff --git a/mods/ambience/sounds/bensound_slowmotion.ogg b/mods/ambience/sounds/bensound_slowmotion.ogg new file mode 100644 index 00000000..3507afa4 Binary files /dev/null and b/mods/ambience/sounds/bensound_slowmotion.ogg differ diff --git a/mods/ambience/sounds/bird.ogg b/mods/ambience/sounds/bird.ogg new file mode 100644 index 00000000..1ee96ad2 Binary files /dev/null and b/mods/ambience/sounds/bird.ogg differ diff --git a/mods/ambience/sounds/bird1.ogg b/mods/ambience/sounds/bird1.ogg deleted file mode 100755 index ce103505..00000000 Binary files a/mods/ambience/sounds/bird1.ogg and /dev/null differ diff --git a/mods/ambience/sounds/bird2.ogg b/mods/ambience/sounds/bird2.ogg deleted file mode 100755 index 3c9427ed..00000000 Binary files a/mods/ambience/sounds/bird2.ogg and /dev/null differ diff --git a/mods/ambience/sounds/birdsongnl.ogg b/mods/ambience/sounds/birdsongnl.ogg new file mode 100644 index 00000000..89d262b7 Binary files /dev/null and b/mods/ambience/sounds/birdsongnl.ogg differ diff --git a/mods/ambience/sounds/bluejay.ogg b/mods/ambience/sounds/bluejay.ogg old mode 100755 new mode 100644 diff --git a/mods/ambience/sounds/canadianloon2.ogg b/mods/ambience/sounds/canadianloon2.ogg old mode 100755 new mode 100644 diff --git a/mods/ambience/sounds/cardinal.ogg b/mods/ambience/sounds/cardinal.ogg deleted file mode 100755 index ad8c8366..00000000 Binary files a/mods/ambience/sounds/cardinal.ogg and /dev/null differ diff --git a/mods/ambience/sounds/coyote.ogg b/mods/ambience/sounds/coyote2.ogg old mode 100755 new mode 100644 similarity index 100% rename from mods/ambience/sounds/coyote.ogg rename to mods/ambience/sounds/coyote2.ogg diff --git a/mods/ambience/sounds/craw.ogg b/mods/ambience/sounds/craw.ogg old mode 100755 new mode 100644 index 43f51e81..7b87a6b2 Binary files a/mods/ambience/sounds/craw.ogg and b/mods/ambience/sounds/craw.ogg differ diff --git a/mods/ambience/sounds/crestedlark.ogg b/mods/ambience/sounds/crestedlark.ogg deleted file mode 100755 index 8757747e..00000000 Binary files a/mods/ambience/sounds/crestedlark.ogg and /dev/null differ diff --git a/mods/ambience/sounds/cricket.ogg b/mods/ambience/sounds/cricket.ogg deleted file mode 100755 index 63d06e3c..00000000 Binary files a/mods/ambience/sounds/cricket.ogg and /dev/null differ diff --git a/mods/ambience/sounds/dark_ambiance.ogg b/mods/ambience/sounds/dark_ambiance.ogg new file mode 100644 index 00000000..e3099d1b Binary files /dev/null and b/mods/ambience/sounds/dark_ambiance.ogg differ diff --git a/mods/ambience/sounds/deer.ogg b/mods/ambience/sounds/deer.ogg old mode 100755 new mode 100644 diff --git a/mods/ambience/sounds/desertwind.ogg b/mods/ambience/sounds/desertwind.ogg deleted file mode 100755 index b4416221..00000000 Binary files a/mods/ambience/sounds/desertwind.ogg and /dev/null differ diff --git a/mods/ambience/sounds/drippingwater1.ogg b/mods/ambience/sounds/drippingwater1.ogg deleted file mode 100755 index 60fee869..00000000 Binary files a/mods/ambience/sounds/drippingwater1.ogg and /dev/null differ diff --git a/mods/ambience/sounds/drippingwater2.ogg b/mods/ambience/sounds/drippingwater2.ogg deleted file mode 100755 index a5eadd4d..00000000 Binary files a/mods/ambience/sounds/drippingwater2.ogg and /dev/null differ diff --git a/mods/ambience/sounds/drippingwater_drip_a.ogg b/mods/ambience/sounds/drippingwater_drip_a.ogg new file mode 100644 index 00000000..84c3e013 Binary files /dev/null and b/mods/ambience/sounds/drippingwater_drip_a.ogg differ diff --git a/mods/ambience/sounds/drippingwater_drip_b.ogg b/mods/ambience/sounds/drippingwater_drip_b.ogg new file mode 100644 index 00000000..18790fc1 Binary files /dev/null and b/mods/ambience/sounds/drippingwater_drip_b.ogg differ diff --git a/mods/ambience/sounds/drippingwater_drip_c.ogg b/mods/ambience/sounds/drippingwater_drip_c.ogg new file mode 100644 index 00000000..ad2424a3 Binary files /dev/null and b/mods/ambience/sounds/drippingwater_drip_c.ogg differ diff --git a/mods/ambience/sounds/drowning_gasp.ogg b/mods/ambience/sounds/drowning_gasp.ogg new file mode 100644 index 00000000..5d62a8ec Binary files /dev/null and b/mods/ambience/sounds/drowning_gasp.ogg differ diff --git a/mods/ambience/sounds/earth01a.ogg b/mods/ambience/sounds/earth01a.ogg new file mode 100644 index 00000000..d08740f0 Binary files /dev/null and b/mods/ambience/sounds/earth01a.ogg differ diff --git a/mods/ambience/sounds/eastern_feeling.ogg b/mods/ambience/sounds/eastern_feeling.ogg new file mode 100644 index 00000000..d691313d Binary files /dev/null and b/mods/ambience/sounds/eastern_feeling.ogg differ diff --git a/mods/ambience/sounds/fiji_beach.ogg b/mods/ambience/sounds/fiji_beach.ogg new file mode 100644 index 00000000..f6831d66 Binary files /dev/null and b/mods/ambience/sounds/fiji_beach.ogg differ diff --git a/mods/ambience/sounds/frog.ogg b/mods/ambience/sounds/frog.ogg old mode 100755 new mode 100644 diff --git a/mods/ambience/sounds/gull.ogg b/mods/ambience/sounds/gull.ogg old mode 100755 new mode 100644 diff --git a/mods/ambience/sounds/horned_owl.ogg b/mods/ambience/sounds/horned_owl.ogg new file mode 100644 index 00000000..f30d0b3c Binary files /dev/null and b/mods/ambience/sounds/horned_owl.ogg differ diff --git a/mods/ambience/sounds/hornedowl.ogg b/mods/ambience/sounds/hornedowl.ogg deleted file mode 100755 index 82e3268b..00000000 Binary files a/mods/ambience/sounds/hornedowl.ogg and /dev/null differ diff --git a/mods/ambience/sounds/lake_waves_2_calm.ogg b/mods/ambience/sounds/lake_waves_2_calm.ogg new file mode 100644 index 00000000..2616958f Binary files /dev/null and b/mods/ambience/sounds/lake_waves_2_calm.ogg differ diff --git a/mods/ambience/sounds/lake_waves_2_variety.ogg b/mods/ambience/sounds/lake_waves_2_variety.ogg new file mode 100644 index 00000000..bd1dc6ce Binary files /dev/null and b/mods/ambience/sounds/lake_waves_2_variety.ogg differ diff --git a/mods/ambience/sounds/lava.ogg b/mods/ambience/sounds/lava.ogg deleted file mode 100755 index d417e515..00000000 Binary files a/mods/ambience/sounds/lava.ogg and /dev/null differ diff --git a/mods/ambience/sounds/peacock.ogg b/mods/ambience/sounds/peacock.ogg old mode 100755 new mode 100644 diff --git a/mods/ambience/sounds/rainymemory.ogg b/mods/ambience/sounds/rainymemory.ogg new file mode 100644 index 00000000..bf5de805 Binary files /dev/null and b/mods/ambience/sounds/rainymemory.ogg differ diff --git a/mods/ambience/sounds/robin.ogg b/mods/ambience/sounds/robin.ogg deleted file mode 100755 index 3f4748ca..00000000 Binary files a/mods/ambience/sounds/robin.ogg and /dev/null differ diff --git a/mods/ambience/sounds/robin2.ogg b/mods/ambience/sounds/robin2.ogg new file mode 100644 index 00000000..8bbb161d Binary files /dev/null and b/mods/ambience/sounds/robin2.ogg differ diff --git a/mods/ambience/sounds/scuba.ogg b/mods/ambience/sounds/scuba.ogg deleted file mode 100755 index a318c687..00000000 Binary files a/mods/ambience/sounds/scuba.ogg and /dev/null differ diff --git a/mods/ambience/sounds/scuba1bubbles.ogg b/mods/ambience/sounds/scuba1bubbles.ogg new file mode 100644 index 00000000..ffc1431e Binary files /dev/null and b/mods/ambience/sounds/scuba1bubbles.ogg differ diff --git a/mods/ambience/sounds/scuba1calm.ogg b/mods/ambience/sounds/scuba1calm.ogg new file mode 100644 index 00000000..e1e76cff Binary files /dev/null and b/mods/ambience/sounds/scuba1calm.ogg differ diff --git a/mods/ambience/sounds/scuba1calm2.ogg b/mods/ambience/sounds/scuba1calm2.ogg new file mode 100644 index 00000000..c1a348a2 Binary files /dev/null and b/mods/ambience/sounds/scuba1calm2.ogg differ diff --git a/mods/ambience/sounds/scuba1interestingbubbles.ogg b/mods/ambience/sounds/scuba1interestingbubbles.ogg new file mode 100644 index 00000000..b17d33c0 Binary files /dev/null and b/mods/ambience/sounds/scuba1interestingbubbles.ogg differ diff --git a/mods/ambience/sounds/scuba1tubulentbubbles.ogg b/mods/ambience/sounds/scuba1tubulentbubbles.ogg new file mode 100644 index 00000000..555edff9 Binary files /dev/null and b/mods/ambience/sounds/scuba1tubulentbubbles.ogg differ diff --git a/mods/ambience/sounds/seagull.ogg b/mods/ambience/sounds/seagull.ogg old mode 100755 new mode 100644 diff --git a/mods/ambience/sounds/small_waterfall.ogg b/mods/ambience/sounds/small_waterfall.ogg new file mode 100644 index 00000000..40208303 Binary files /dev/null and b/mods/ambience/sounds/small_waterfall.ogg differ diff --git a/mods/ambience/sounds/swim_splashing.ogg b/mods/ambience/sounds/swim_splashing.ogg deleted file mode 100755 index 4c40847b..00000000 Binary files a/mods/ambience/sounds/swim_splashing.ogg and /dev/null differ diff --git a/mods/ambience/sounds/water_swimming_splashing.ogg b/mods/ambience/sounds/water_swimming_splashing.ogg new file mode 100644 index 00000000..7a9bbf31 Binary files /dev/null and b/mods/ambience/sounds/water_swimming_splashing.ogg differ diff --git a/mods/ambience/sounds/water_swimming_splashing_breath.ogg b/mods/ambience/sounds/water_swimming_splashing_breath.ogg new file mode 100644 index 00000000..06bed351 Binary files /dev/null and b/mods/ambience/sounds/water_swimming_splashing_breath.ogg differ diff --git a/mods/ambience/sounds/waterfall.ogg b/mods/ambience/sounds/waterfall.ogg deleted file mode 100755 index 1035c93a..00000000 Binary files a/mods/ambience/sounds/waterfall.ogg and /dev/null differ diff --git a/mods/ambience/sounds/wind.ogg b/mods/ambience/sounds/wind.ogg deleted file mode 100755 index 092be4b1..00000000 Binary files a/mods/ambience/sounds/wind.ogg and /dev/null differ diff --git a/mods/ambience/sounds/wolves.ogg b/mods/ambience/sounds/wolves.ogg deleted file mode 100755 index f23b1f97..00000000 Binary files a/mods/ambience/sounds/wolves.ogg and /dev/null differ diff --git a/mods/ambience/todo.txt b/mods/ambience/todo.txt new file mode 100644 index 00000000..4f95977a --- /dev/null +++ b/mods/ambience/todo.txt @@ -0,0 +1,11 @@ +To Do: + +-add random_volume parameter to night normal, day normal, & cave normal sounds to create feeling of distance. + +m-get constant birds more quiet during the day +m-bats seem way too frequent now? +m-when playing multiplayer seems to increase frequency of music & normal sounds to the point where they are obnoxious +m-which songs should go with which environments? Dark songs in caves or night, light sounds during day. +m-may be drowning out some of the normal sound effects like walking on stone. +l-what about other weird bubble +l-put in wind/ wind in trees during day and night diff --git a/mods/music/depends.txt b/mods/music/depends.txt deleted file mode 100755 index 892af91d..00000000 --- a/mods/music/depends.txt +++ /dev/null @@ -1 +0,0 @@ -soundset? diff --git a/mods/music/init.lua b/mods/music/init.lua deleted file mode 100755 index 3b3bdf2b..00000000 --- a/mods/music/init.lua +++ /dev/null @@ -1,85 +0,0 @@ - -local players = {} -local music_volume = 1 -local SOUNDVOLUME = 1 --- compatibility with soundset mod -local get_volume -if (minetest.get_modpath("soundset")) ~= nil then - get_volume = soundset.get_gain -else - get_volume = function (player_name, sound_type) return SOUNDVOLUME end - -- set volume command - minetest.register_chatcommand("svol", { - params = "", - description = "set sound volume (0.1 to 1.0)", - privs = {server=true}, - func = function(name, param) - if tonumber(param) then - SOUNDVOLUME = tonumber(param) - minetest.chat_send_player(name, "Sound volume set.") - else - minetest.chat_send_player(name, "Sound volume no set, bad param.") - end - end, - }) -end - - -local musics = { - --{name="StrangelyBeautifulShort", length=3*60+.5, gain=music_volume*.7}, - --{name="Loneliness", length=3*60+51, gain=music_volume*.9}, - --{name="AvalonShort", length=2*60+58, gain=music_volume*1.4}, - --{name="Aube", length=2*60+24, gain=music_volume*1.8}, - --{name="Interlude", length=3*60+30.5, gain=music_volume*1.8}, - --{name="mtest", length=4*60+33, gain=music_volume}, - --{name="echos", length=2*60+26, gain=music_volume}, - --{name="FoamOfTheSea", length=1*60+50, gain=music_volume}, - {name="Ambivalent", length=2*60+31, gain=music_volume*.9}, - --{name="eastern_feeling", length=3*60+51, gain=music_volume}, - --{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume}, - {name="EtherealShort", length=3*60+4, gain=music_volume*.7}, - --{name="Mute", length=3*60+43, gain=music_volume*.9}, - --{name="FarawayShort", length=3*60+5, gain=music_volume*.7}, - {name="dark_ambiance", length=44, gain=music_volume} -} - - --- stops all sounds that are not in still_playing -local stop_sound = function(player_name) - if players[player_name] ~= nil then - minetest.sound_stop(players[player_name]) - players[player_name] = nil - end -end - --- start playing the sound, set the handler and delete the handler after sound is played -local play_sound = function(player_name, music, gain) - if players[player_name] == nil then - local handler = minetest.sound_play(music.name, {to_player=player_name, gain=music.gain*gain}) - if handler ~= nil then - players[player_name] = handler - minetest.after(music.length, stop_sound, player_name) - end - end -end - - -local function tick() - for _, player in ipairs(minetest.get_connected_players()) do - local player_name = player:get_player_name() - local gain = get_volume(player_name, "music") - if gain > 0 and players[player_name] == nil then - local music = musics[math.random(#musics)] - play_sound(player_name, music, gain) - end - end - minetest.after(math.random(15,30)*60, tick) -end - -minetest.register_on_leaveplayer(function(player) - local player_name = player:get_player_name() - stop_sound(player_name) -end) - -minetest.after(60, tick) - diff --git a/mods/music/sounds/EtherealShort.ogg b/mods/music/sounds/EtherealShort.ogg deleted file mode 100755 index f0734515..00000000 Binary files a/mods/music/sounds/EtherealShort.ogg and /dev/null differ diff --git a/mods/music/sounds/SoundLicenses.txt b/mods/music/sounds/SoundLicenses.txt deleted file mode 100755 index ba212391..00000000 --- a/mods/music/sounds/SoundLicenses.txt +++ /dev/null @@ -1,119 +0,0 @@ ---------------Music Lic: -Amethystium: ---Avalon ---Ethereal ---Faraway ---Strangely Beautiful -Used with kind permission from Øystein Ramfjord / AM.mu Records - -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 - -Obani: ---Interlude -This sounds is under the license CC-BY-SA - ------------Sound Lic: ---Nightime Sound, Recorded by Mike Koenig, License: Attribution 3.0 http://soundbible.com/951-Nightime.html ---Crickets At Night Sound, License: Attribution 3.0 | Recorded by Mike Koenig |http://soundbible.com/365-Crickets-At-Night.html - ---Medium Pack Of Wolves Howling, License: Public Domain | Recorded by fws.gov, http://soundbible.com/277-Medium-Pack-Of-Wolves-Howling.html - ---Horned Owl Sound, License: Attribution 3.0 | Recorded by Mike Koenig , http://soundbible.com/1851-Horned-Owl.html ---Bats In Cave Sound, License: Attr-Noncommercial 3.0 | Recorded by Mike Koenig , http://soundbible.com/1939-Bats-In-Cave.html - ---Spooky Water Drops Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/380-Spooky-Water-Drops.html - - --- Single Water Droplet Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/384-Single-Water-Droplet.html - ---HollowWind, Black Boe, Creative Commons 0 License, http://www.freesound.org/people/Black%20Boe/sounds/22331/ - ---drippingwater*.ogg sounds: CC0, Dripping Water Mod, by kddekadenz, http://minetest.net/forum/viewtopic.php?id=1688 - ---best cardinal bird: License: Attribution 3.0 | Recorded by PsychoBird, http://soundbible.com/1515-Best-Cardinal-Bird.html - ---birdsongnl: the Attribution License, HerbertBoland, http://www.freesound.org/people/HerbertBoland/sounds/28312/ (end) - ---robin2: Attribution License, reinsamba, http://www.freesound.org/people/reinsamba/sounds/32479/ (end) - ---Craw.WAV, Attribution License, inchadney, http://www.freesound.org/people/inchadney/sounds/52450/ - ---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/ - -ComboWind uses: ---wind-in-the-trees -Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/16995/ ---drygrassInWind- Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/146436/ - ---Splash: Attribution 3.0 | Recorded by BlastwaveFx.com, http://soundbible.com/546-Fish-Splashing.html - ---small_waterfall Attribution License, volivieri, http://www.freesound.org/people/volivieri/sounds/38390/ - ---Lake_Waves_2*, Attribution License, Benboncan, http://www.freesound.org/people/Benboncan/sounds/67884/ - ---water_swimming_splashing*, Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/ - ---earth01a, Creative Commons 0 License., Halion , http://www.freesound.org/people/Halion/sounds/17785 - ---fiji_beach, Creative Commons 0 License, c97059890, http://www.freesound.org/people/c97059890/sounds/21754/ - ---seagull, Attribution Noncommercial License., hazure, http://www.freesound.org/people/hazure/sounds/23707/, - -desert: -coyote2, Attribution License, rogerforeman, http://www.freesound.org/people/rogerforeman/sounds/68068/ -http://www.freesound.org/people/Proxima4/sounds/104319/ -Desert Monolith.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104319/ -Rattlesnake Rattle, Public Domain, fws.gov, http://soundbible.com/237-Rattlesnake-Rattle.html - -flying: -crystal_airlines: Attribution License, suonho, http://www.freesound.org/people/suonho/sounds/56364/ - -----------------Not used yet: -desert: -Desert Simple.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104320/ - - 313hummer (Jordan Craige) ---echos http://soundcloud.com/jordan-craige/echos-1 -Creative Commons Attribution license (reuse allowed) Attribution 3.0 Unported (CC BY 3.0) -Not Used:--FoamOfTheSea http://soundcloud.com/jordan-craige/foam-of-the-sea - -xi-intersection: -http://soundcloud.com/xi-intersection/mass-effect-uncharted-worlds Creative Commons License ---not used: -http://soundcloud.com/xi-intersection/donkey-kong-country-2-flight -http://soundcloud.com/kogyo/kogyo-skalar-m1 - -lava: -http://www.freesound.org/people/Halion/sounds/17785/ (almost as good cc) (combine with rocks falling?) -http://www.freesound.org/people/pushtobreak/sounds/17823/ (attrib non cc really good) -http://www.freesound.org/people/klankbeeld/sounds/123970/ (horror rhythm) -Rockfall in mine.wav http://www.freesound.org/people/Benboncan/sounds/60085/ - - -http://www.freesound.org/people/snotch/sounds/96175/ (mud volcano) - ---natural night sounds in Boquete.wav, Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/15851/ -http://www.freesound.org/people/Dynamicell/sounds/17553/ -http://www.freesound.org/people/juskiddink/sounds/78955/ aspen tree in wind -http://www.freesound.org/people/Benboncan/sounds/69761/ wind in hedge birds animals - - -ButterflyTea: -Creative Commons : Attribution-Noncommercial-Share Alike 3.0 -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 - -zero-project diff --git a/mods/music/sounds/dark_ambiance.ogg b/mods/music/sounds/dark_ambiance.ogg deleted file mode 100755 index e298b97b..00000000 Binary files a/mods/music/sounds/dark_ambiance.ogg and /dev/null differ diff --git a/mods/pmobs/wolf.lua b/mods/pmobs/wolf.lua index c7bd4e61..5562f1be 100644 --- a/mods/pmobs/wolf.lua +++ b/mods/pmobs/wolf.lua @@ -42,7 +42,7 @@ mobs:register_mob( lava_damage = 5, light_damage = 0, on_rightclick = function(self, clicker) - tool = clicker:get_wielded_item() + local tool = clicker:get_wielded_item() if tool:get_name() == "mobs:meat_raw" then clicker:get_inventory():remove_item("main", "mobs:meat_raw") minetest.add_entity(self.object:getpos(), "pmobs:dog") diff --git a/mods/soundset/README.md b/mods/soundset/README.md deleted file mode 100755 index 6f4003dc..00000000 --- a/mods/soundset/README.md +++ /dev/null @@ -1,40 +0,0 @@ -soundset MOD for MINETEST -======================== - -by Mg (@LeMagnesium) and @crabman77 - -YOUR mod can use THIS mod to have a volume that's adjustable by the player(s) - -EXAMPLE - -minetest.sound_play("music_file", {to_player=player:get_player_name(),gain=sounds.get_gain(player:get_player_name(), "music")}) - -OR - -minetest.sound_play("mob_sound", {to_player=player:get_player_name(),gain=sounds.get_gain(player:get_player_name(), "mobs")}) - -OR - -minetest.sound_play("wind_sound", {to_player=player:get_player_name(),gain=sounds.get_gain(player:get_player_name(), "ambience")}) - - - - -commandchat - -/soundset : display menu - -/soundsetg : display player config - -/soundsets : set volume - - - -Licenses images: - Author : Obani CC-BY - -0.1 - Initial Release - -0.2 - change default volume to 50, add serialise|deserialise to read|write config file - -0.3 - add menu setting and button for unified_inventory and chatcommand to display menu diff --git a/mods/soundset/depends.txt b/mods/soundset/depends.txt deleted file mode 100755 index 20b7c424..00000000 --- a/mods/soundset/depends.txt +++ /dev/null @@ -1 +0,0 @@ -unified_inventory? diff --git a/mods/soundset/init.lua b/mods/soundset/init.lua deleted file mode 100755 index ac8edec1..00000000 --- a/mods/soundset/init.lua +++ /dev/null @@ -1,230 +0,0 @@ -minetest.log("action","[mod soundset] Loading...") - -soundset = {} -soundset.file = minetest.get_worldpath() .. "/sounds_config.txt" -soundset.gainplayers = {} -local tmp = {} -tmp["music"] = {} -tmp["ambience"] = {} -tmp["other"] = {} - -local function save_sounds_config() - local input = io.open(soundset.file, "w") - if input then - input:write(minetest.serialize(soundset.gainplayers)) - input:close() - else - minetest.log("action","echec d'ouverture (mode:w) de " .. soundset.file) - end -end - - -local function load_sounds_config() - local file = io.open(soundset.file, "r") - if file then - soundset.gainplayers = minetest.deserialize(file:read("*all")) - file:close() - end - if soundset.gainplayers == nil or type(soundset.gainplayers) ~= "table" then - soundset.gainplayers = {} - end -end - -load_sounds_config() - -soundset.set_sound = function(name, param) - if param == "" then - minetest.chat_send_player(name, "/setsound ") - return - end - local param_name, param_value = param:match("^(%S+)%s(%S+)$") - if param_name == nil or param_value == nil then - minetest.chat_send_player(name, "invalid param, /setsound ") - return - end - - if param_name ~= "music" and param_name ~= "ambience" and param_name ~= "mobs" and param_name ~= "other" then - minetest.chat_send_player(name, "invalid param " .. param_name) - return - end - local value = tonumber(param_value) - if value == nil then - minetest.chat_send_player(name, "invalid value, " ..param_value .. " must be number") - return - end - - if value < 0 then - value = 0 - elseif value > 100 then - value = 100 - end - - if soundset.gainplayers[name][param_name] == value then - minetest.chat_send_player(name, "volume " .. param_name .. " already set to " .. value) - return - end - - soundset.gainplayers[name][param_name] = value - minetest.chat_send_player(name, "sound " .. param_name .. " set to " .. value) - save_sounds_config() -end - - -soundset.get_gain = function(name, sound_type) - if name == nil or name == "" then - return 1 - end - if not soundset.gainplayers[name] then return 1 end - local gain = soundset.gainplayers[name][sound_type] - if gain == nil then - return 1 - end - return gain/100 -end - -local inc = function(value) - value = value + 5 - if value > 100 then - value = 100 - end - return value -end - -local dec = function(value) - value = value - 5 - if value < 0 then - value = 0 - end - return value -end - - -local formspec = "size[6,6]".. - "label[2,0;Sound Menu]".. - "label[0,1.2;MUSIC]".. - "button[1.6,1;1,1;vmusic;-]".. - "label[2.7,1.2;%s]".. - "button[3.5,1;1,1;vmusic;+]".. - "label[0,2.2;AMBIENCE]".. - "button[1.6,2;1,1;vambience;-]".. - "label[2.7,2.2;%s]".. - "button[3.5,2;1,1;vambience;+]".. - "label[0,3.2;OTHER]".. - "button[1.6,3;1,1;vother;-]".. - "label[2.7,3.2;%s]".. - "button[3.5,3;1,1;vother;+]".. - "button_exit[0.5,5.2;1.5,1;abort;Abort]".. - "button_exit[4,5.2;1.5,1;abort;Ok]" - - -local on_show_settings = function(name, music, ambience, other) - tmp["music"][name] = music - tmp["ambience"][name] = ambience - tmp["other"][name] = other - minetest.show_formspec( name, "soundset:settings", string.format(formspec, tostring(music), tostring(ambience), tostring(other) )) -end - -local clear_tmp = function(name) - tmp["music"][name] = nil - tmp["ambience"][name] = nil - tmp["other"][name] = nil -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname == "soundset:settings" then - local name = player:get_player_name() - if not name or name == "" then return end - local fmusic = tmp["music"][name] or 50 - local fambience = tmp["ambience"][name] or 50 - local fother = tmp["other"][name] or 50 - if fields["abort"] == "Ok" then - if soundset.gainplayers[name]["music"] ~= fmusic or soundset.gainplayers[name]["ambience"] ~= fambience or soundset.gainplayers[name]["other"] ~= fother then - soundset.gainplayers[name]["music"] = fmusic - soundset.gainplayers[name]["ambience"] = fambience - soundset.gainplayers[name]["other"] = fother - save_sounds_config() - end - clear_tmp(name) - return - elseif fields["abort"] == "Abort" then - clear_tmp(name) - return - elseif fields["vmusic"] == "+" then - fmusic = inc(fmusic) - elseif fields["vmusic"] == "-" then - fmusic = dec(fmusic) - elseif fields["vambience"] == "+" then - fambience = inc(fambience) - elseif fields["vambience"] == "-" then - fambience = dec(fambience) - elseif fields["vother"] == "+" then - fother = inc(fother) - elseif fields["vother"] == "-" then - fother = dec(fother) - elseif fields["quit"] == "true" then - clear_tmp(name) - return - else - return - end - - on_show_settings(name, fmusic, fambience, fother) - end -end) - - -if (minetest.get_modpath("unified_inventory")) then - unified_inventory.register_button("menu_soundset", { - type = "image", - image = "soundset_menu_icon.png", - tooltip = "sounds menu ", - show_with = false, --Modif MFF (Crabman 30/06/2015) - action = function(player) - local name = player:get_player_name() - if not name then return end - on_show_settings(name, soundset.gainplayers[name]["music"], soundset.gainplayers[name]["ambience"], soundset.gainplayers[name]["other"]) - end, - }) -end - -minetest.register_chatcommand("soundset", { - params = "", - description = "Display volume menu formspec", - privs = {interact=true}, - func = function(name, param) - if not name then return end - on_show_settings(name, soundset.gainplayers[name]["music"], soundset.gainplayers[name]["ambience"], soundset.gainplayers[name]["other"]) - end -}) - - -minetest.register_chatcommand("soundsets", { - params = " ", - description = "Set volume sound ", - privs = {interact=true}, - func = soundset.set_sound, -}) - -minetest.register_chatcommand("soundsetg", { - params = "", - description = "Display volume sound ", - privs = {interact=true}, - func = function(name, param) - local conf = "" - for k, v in pairs(soundset.gainplayers[name]) do - conf = conf .. " " .. k .. ":" .. v - end - minetest.chat_send_player(name, "sounds conf " .. conf) - minetest.log("action","Player ".. name .. " sound conf " .. conf) - end -}) - -minetest.register_on_joinplayer(function(player) - local name = player:get_player_name() - if soundset.gainplayers[name] == nil then - soundset.gainplayers[name] = { ["music"] = 50, ["ambience"] = 50, ["mobs"] = 50, ["other"] = 50 } - end -end) - -minetest.log("action","[mod soundset] Loaded") - diff --git a/mods/soundset/textures/soundset_menu_icon.png b/mods/soundset/textures/soundset_menu_icon.png deleted file mode 100644 index 79792161..00000000 Binary files a/mods/soundset/textures/soundset_menu_icon.png and /dev/null differ diff --git a/worlds/minetestforfun/world.mt b/worlds/minetestforfun/world.mt index 80a9bc5d..db73ec6c 100644 --- a/worlds/minetestforfun/world.mt +++ b/worlds/minetestforfun/world.mt @@ -220,9 +220,7 @@ load_mod_time_regulation = true load_mod_h2omes = true load_mod_player_physics = true -load_mod_soundset = true load_mod_ambience = true -load_mod_music = true load_mod_areas = true load_mod_markers = true