diff --git a/mods/ambience_modpack/ambience/depends.txt b/mods/ambience_modpack/ambience/depends.txt index 4ad96d51..29ce1879 100755 --- a/mods/ambience_modpack/ambience/depends.txt +++ b/mods/ambience_modpack/ambience/depends.txt @@ -1 +1,2 @@ default +soundset diff --git a/mods/ambience_modpack/ambience/init.lua b/mods/ambience_modpack/ambience/init.lua index b1ee9c9c..096a4a35 100755 --- a/mods/ambience_modpack/ambience/init.lua +++ b/mods/ambience_modpack/ambience/init.lua @@ -50,8 +50,8 @@ local music_volume = 0.3 ---------------------------------------------------------------------------------------------------- local ambiences local counter=0--***************** -local SOUNDVOLUME = 1 -local MUSICVOLUME = 1 +--local SOUNDVOLUME = 1 +--local MUSICVOLUME = 1 local sound_vol = 1 local last_x_pos = 0 local last_y_pos = 0 @@ -492,10 +492,10 @@ local play_sound = function(player, list, number, is_music) local gain = 1.0 if list[number].gain ~= nil then if is_music then - gain = list[number].gain*MUSICVOLUME + gain = list[number].gain*sounds.get_gain(player_name, "musique") --minetest.chat_send_all("gain music: " .. gain ) else - gain = list[number].gain*SOUNDVOLUME + gain = list[number].gain*sounds.get_gain(player_name, "ambience") --minetest.chat_send_all("gain sound: " .. gain ) end end @@ -521,7 +521,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -531,7 +531,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -541,7 +541,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -551,7 +551,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -561,7 +561,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -571,7 +571,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -581,7 +581,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -591,7 +591,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -601,7 +601,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -611,7 +611,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -621,7 +621,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -631,7 +631,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -641,7 +641,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -651,7 +651,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -661,7 +661,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -671,7 +671,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -681,7 +681,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -691,7 +691,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) played_on_start = false end minetest.sound_stop(list.handler[player_name]) @@ -702,7 +702,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) -- minetest.chat_send_all("list.on_stop " .. list.on_stop ) played_on_start = false end @@ -717,7 +717,7 @@ local stop_sound = function(still_playing, player) -- 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) played_on_start = false end minetest.sound_stop(list.handler[player_name]) @@ -728,7 +728,7 @@ local stop_sound = function(still_playing, player) 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(),gain=SOUNDVOLUME}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -757,7 +757,7 @@ minetest.register_globalstep(function(dtime) -- 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}) + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name(),gain=sounds.get_gain(player:get_player_name(), "ambience")}) end -- minetest.chat_send_all("ambience: " ..ambience ) -- if ambience.on_start ~= nil and played_on_start_flying == false then @@ -774,6 +774,7 @@ minetest.register_globalstep(function(dtime) end end) +--[[ minetest.register_chatcommand("svol", { params = "", description = "set volume of sounds, default 1 normal volume.", @@ -804,4 +805,5 @@ minetest.register_chatcommand("mvol", { -- ambiences = get_ambience(player) minetest.chat_send_player(name, "Music volume set to " .. param .. ".") end, }) +]]