.29 Flying Sound

This commit is contained in:
Neuromancer 2012-09-16 08:51:56 -05:00
parent 26bbeace26
commit ca404b2395
6 changed files with 835 additions and 62 deletions

Binary file not shown.

View File

@ -1,7 +1,12 @@
--------------------------------------------------------------------------------------------------------
--Ambiance Configuration for version .28
--working on treading water already trumps beach, standing in water should not.
--moving while standing in water should splash not swim.
--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?
--removing unneeded stuff.
local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000.
@ -37,12 +42,15 @@ local music_volume = 0.3
----------------------------------------------------------------------------------------------------
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 night = {
handler = {},
frequency = night_frequency,
@ -125,6 +133,14 @@ local desert_frequent = {
{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
@ -256,26 +272,39 @@ 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
pos.y = pos.y+0.99
--minetest.chat_send_all("node_under_feet(" .. nodename .. ")")
end
local get_ambience = function(player)
local player_is_moving = false
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 = true
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
@ -284,7 +313,7 @@ local get_ambience = function(player)
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
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
@ -292,7 +321,7 @@ local get_ambience = function(player)
--walking in water nw, m splashing
--treading water w, nm sloshing
--standing in water nw, nm beach trumps, then sloshing
if player_is_moving then
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}
@ -306,7 +335,7 @@ local get_ambience = function(player)
return {splashing_water}
end
end
else--player is not moving
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}
@ -319,6 +348,41 @@ local get_ambience = function(player)
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}
--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
@ -363,8 +427,8 @@ local get_ambience = function(player)
end
end
pos.y = pos.y-2
nodename = minetest.env:get_node(pos).name
-- pos.y = pos.y-2
-- nodename = minetest.env:get_node(pos).name
-- minetest.chat_send_all("Found " .. nodename .. pos.y )
@ -609,8 +673,30 @@ local stop_sound = function(still_playing, player)
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
@ -626,11 +712,21 @@ minetest.register_globalstep(function(dtime)
local ambiences = get_ambience(player)
stop_sound(ambiences, player)
for _,ambience in pairs(ambiences) do
if math.random(1, 1000) <= ambience.frequency then
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

722
ambience/init29debug.lua Normal file
View File

@ -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)

View File

@ -1,48 +0,0 @@
{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 00000000000000000000}Symbol;}{\f10\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}
{\f36\froman\fcharset238\fprq2 Times New Roman CE;}{\f37\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f39\froman\fcharset161\fprq2 Times New Roman Greek;}{\f40\froman\fcharset162\fprq2 Times New Roman Tur;}
{\f41\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f42\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f43\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f44\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
{\f56\fmodern\fcharset238\fprq1 Courier New CE;}{\f57\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f59\fmodern\fcharset161\fprq1 Courier New Greek;}{\f60\fmodern\fcharset162\fprq1 Courier New Tur;}{\f61\fmodern\fcharset177\fprq1 Courier New (Hebrew);}
{\f62\fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f63\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f64\fmodern\fcharset163\fprq1 Courier New (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden
Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\cs15 \additive \ul\cf2 \sbasedon10 \styrsid3175830 Hyperlink;}}
{\*\listtable{\list\listtemplateid-2426772\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat16\levelspace0\levelindent0{\leveltext\leveltemplateid1000389580\'01-;}{\levelnumbers;}
\loch\af0\hich\af0\dbch\af0\fbias0\hres0\chhres0 \fi-360\li720\jclisttab\tx720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698691
\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li1440\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698693
\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li2160\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698689
\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li2880\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698691
\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li3600\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698693
\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li4320\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698689
\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0\hres0\chhres0 \fi-360\li5040\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698691
\'01o;}{\levelnumbers;}\f2\fbias0\hres0\chhres0 \fi-360\li5760\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698693
\'01\u-3929 ?;}{\levelnumbers;}\f10\fbias0\hres0\chhres0 \fi-360\li6480\jclisttab\tx6480\lin6480 }{\listname ;}\listid1048454261}}{\*\listoverridetable{\listoverride\listid1048454261\listoverridecount0\ls1}}{\*\rsidtbl \rsid3175830}
{\*\generator Microsoft Word 10.0.6866;}{\info{\title These sounds are used for the Mod for Minetest; Ambiance}{\author Jordan}{\operator Jordan}{\creatim\yr2012\mo8\dy20\hr20\min27}{\revtim\yr2012\mo8\dy20\hr20\min30}{\version1}{\edmins3}{\nofpages1}
{\nofwords68}{\nofchars390}{\nofcharsws457}{\vern16393}{\*\password 00000000}}{\*\xmlnstbl }\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0
\widowctrl\ftnbj\aenddoc\grfdocevents0\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot3175830 \fet0
{\*\wgrffmtfilter 013f}\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang
{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7
\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid3175830 These sounds are used for the Mod for Minetest; Ambiance.
\par
\par The included sounds are }{\insrsid3175830\charrsid3175830 http://creativecommons.org/licenses/by-nc-sa/3.0/}{\insrsid3175830
\par
\par This also includes the sounds in 0.7 of the Ambiance mod.
\par
\par P.S. PilzAdam, Neuromancer, you have a real nice mod; keep up with the good work!
\par
\par }\pard \ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3175830 {\insrsid3175830 - Jordach
\par
\par P.P.S.
\par
\par Contact Me if you would like a license change.
\par
\par jordach.snelling@gmail.com\tab
\par
\par }{\field{\*\fldinst {\insrsid3175830 HYPERLINK "http://twitter.com/jordansnelling" }{\insrsid3175830 {\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b02000000170000002200000068007400740070003a002f002f0074007700690074007400650072002e0063006f006d002f006a006f007200640061006e0073006e0065006c006c0069006e0067000000e0c9ea79f9bace118c8200aa004ba90b4400000068007400740070003a00
2f002f0074007700690074007400650072002e0063006f006d002f006a006f007200640061006e0073006e0065006c006c0069006e0067000000}}}{\fldrslt {\cs15\ul\cf2\insrsid3175830\charrsid8269706 http://twitter.com/jordansnelling}}}\sectd
\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\insrsid3175830\charrsid3175830
\par }}

View File

@ -77,6 +77,9 @@ 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/

Binary file not shown.