1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

adaptation pour utiliser le mod soundset

modification pour incorporer le mod soundset qui permet aux joueurs de regler le volume de la musique et de l'ambience independament
This commit is contained in:
crabman77 2015-02-15 00:41:50 +01:00
parent 9a0acb22c0
commit df18fba3a8
2 changed files with 29 additions and 26 deletions

View File

@ -1 +1,2 @@
default
soundset

View File

@ -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 = "<svol>",
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, })
]]