mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-17 07:50:29 +01:00
add serialise and deserialise and default volume set to 50
add serialise and deserialise set default volume to 50 change variable name "musique" to "music"
This commit is contained in:
parent
b165c5512f
commit
3d599fc0d1
|
@ -492,7 +492,7 @@ local play_sound = function(player, list, number, is_music)
|
||||||
local gain = 1.0
|
local gain = 1.0
|
||||||
if list[number].gain ~= nil then
|
if list[number].gain ~= nil then
|
||||||
if is_music then
|
if is_music then
|
||||||
gain = list[number].gain*sounds.get_gain(player_name, "musique")
|
gain = list[number].gain*sounds.get_gain(player_name, "music")
|
||||||
--minetest.chat_send_all("gain music: " .. gain )
|
--minetest.chat_send_all("gain music: " .. gain )
|
||||||
else
|
else
|
||||||
gain = list[number].gain*sounds.get_gain(player_name, "ambience")
|
gain = list[number].gain*sounds.get_gain(player_name, "ambience")
|
||||||
|
@ -521,7 +521,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = cave
|
local list = cave
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -531,7 +531,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = cave_frequent
|
local list = cave_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -541,7 +541,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = swimming_frequent
|
local list = swimming_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -551,7 +551,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = beach
|
local list = beach
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -561,7 +561,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = beach_frequent
|
local list = beach_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -571,7 +571,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = desert
|
local list = desert
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -581,7 +581,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = desert_frequent
|
local list = desert_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -591,7 +591,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = night
|
local list = night
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -601,7 +601,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = night_frequent
|
local list = night_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -611,7 +611,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = day
|
local list = day
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -621,7 +621,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = day_frequent
|
local list = day_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -631,7 +631,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = music
|
local list = music
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -641,7 +641,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = flowing_water
|
local list = flowing_water
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -651,7 +651,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = flowing_water2
|
local list = flowing_water2
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -661,7 +661,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = lava
|
local list = lava
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -671,7 +671,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = lava2
|
local list = lava2
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -681,7 +681,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = water
|
local list = water
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -691,7 +691,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = water_surface
|
local list = water_surface
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
played_on_start = false
|
played_on_start = false
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
|
@ -702,7 +702,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = water_frequent
|
local list = water_frequent
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
-- minetest.chat_send_all("list.on_stop " .. list.on_stop )
|
-- minetest.chat_send_all("list.on_stop " .. list.on_stop )
|
||||||
played_on_start = false
|
played_on_start = false
|
||||||
end
|
end
|
||||||
|
@ -717,7 +717,7 @@ local stop_sound = function(still_playing, player)
|
||||||
-- minetest.chat_send_all("handler flying " )
|
-- minetest.chat_send_all("handler flying " )
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
-- minetest.chat_send_all("onstop flying" )
|
-- minetest.chat_send_all("onstop flying" )
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
played_on_start = false
|
played_on_start = false
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
|
@ -728,7 +728,7 @@ local stop_sound = function(still_playing, player)
|
||||||
local list = splashing_water
|
local list = splashing_water
|
||||||
if list.handler[player_name] ~= nil then
|
if list.handler[player_name] ~= nil then
|
||||||
if list.on_stop ~= nil then
|
if list.on_stop ~= nil then
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=sounds.get_gain(player_name, "ambience")})
|
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player_name, "ambience")})
|
||||||
end
|
end
|
||||||
minetest.sound_stop(list.handler[player_name])
|
minetest.sound_stop(list.handler[player_name])
|
||||||
list.handler[player_name] = nil
|
list.handler[player_name] = nil
|
||||||
|
@ -757,7 +757,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- end
|
-- end
|
||||||
if ambience.on_start ~= nil and played_on_start == false then
|
if ambience.on_start ~= nil and played_on_start == false then
|
||||||
played_on_start = true
|
played_on_start = true
|
||||||
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name(),gain=sounds.get_gain(player:get_player_name(), "ambience")})
|
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name(),gain=0.5*sounds.get_gain(player:get_player_name(), "ambience")})
|
||||||
end
|
end
|
||||||
-- minetest.chat_send_all("ambience: " ..ambience )
|
-- minetest.chat_send_all("ambience: " ..ambience )
|
||||||
-- if ambience.on_start ~= nil and played_on_start_flying == false then
|
-- if ambience.on_start ~= nil and played_on_start_flying == false then
|
||||||
|
|
|
@ -2,23 +2,23 @@ minetest.log("action","[mod soundset] Loading...")
|
||||||
|
|
||||||
sounds = {}
|
sounds = {}
|
||||||
sounds.file = minetest.get_worldpath() .. "/sounds_config.txt"
|
sounds.file = minetest.get_worldpath() .. "/sounds_config.txt"
|
||||||
sounds.gaindefault = { ["musique"] = 100, ["ambience"] = 100, ["mobs"] = 100, ["other"] = 100 }
|
sounds.gaindefault = { ["music"] = 50, ["ambience"] = 50, ["mobs"] = 50, ["other"] = 50 }
|
||||||
sounds.gainplayers = {}
|
sounds.gainplayers = {}
|
||||||
|
|
||||||
|
|
||||||
sounds.set_sound = function(name, param)
|
sounds.set_sound = function(name, param)
|
||||||
if param == "" then
|
if param == "" then
|
||||||
minetest.chat_send_player(name, "/setsound <musique|ambience|mobs|other> <number>")
|
minetest.chat_send_player(name, "/setsound <music|ambience|mobs|other> <number>")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local param_name, param_value = param:match("^(%S+)%s(%S+)$")
|
local param_name, param_value = param:match("^(%S+)%s(%S+)$")
|
||||||
if param_name == nil or param_value == nil then
|
if param_name == nil or param_value == nil then
|
||||||
minetest.chat_send_player(name, "invalid param, /setsound <musique|ambience|mobs|other> <number>")
|
minetest.chat_send_player(name, "invalid param, /setsound <music|ambience|mobs|other> <number>")
|
||||||
minetest.log("action", "invalid param, see /setsound <musique|ambience|mobs|other> <number>")
|
minetest.log("action", "invalid param, see /setsound <music|ambience|mobs|other> <number>")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if param_name ~= "musique" and param_name ~= "ambience" and param_name ~= "mobs" and param_name ~= "other" then
|
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)
|
minetest.chat_send_player(name, "invalid param " .. param_name)
|
||||||
minetest.log("action", "invalid param, /setsound " .. param_name)
|
minetest.log("action", "invalid param, /setsound " .. param_name)
|
||||||
return
|
return
|
||||||
|
@ -44,39 +44,39 @@ sounds.set_sound = function(name, param)
|
||||||
sounds.gainplayers[name][param_name] = value
|
sounds.gainplayers[name][param_name] = value
|
||||||
minetest.chat_send_player(name, "sound " .. param_name .. " set to " .. value)
|
minetest.chat_send_player(name, "sound " .. param_name .. " set to " .. value)
|
||||||
minetest.log("action", name ..", sound " .. param_name .. " set to " .. value)
|
minetest.log("action", name ..", sound " .. param_name .. " set to " .. value)
|
||||||
local output = io.open(sounds.file, "w")
|
|
||||||
for i, v in pairs(sounds.gainplayers) do
|
|
||||||
output:write(v.musique .. " " .. v.ambience .. " " .. v.mobs .. " " .. v.other .. " " .. i .."\n")
|
|
||||||
end
|
|
||||||
io.close(output)
|
|
||||||
|
|
||||||
|
|
||||||
|
local input = io.open(sounds.file, "w")
|
||||||
|
if input then
|
||||||
|
input:write(minetest.serialize(sounds.gainplayers))
|
||||||
|
input:close()
|
||||||
|
else
|
||||||
|
minetest.log("action","echec d'ouverture (mode:w) de " .. sounds.file)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
sounds.get_gain = function(name, sound_type)
|
sounds.get_gain = function(name, sound_type)
|
||||||
return sounds.gainplayers[name][sound_type]/50
|
if name == nil or name == "" then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
local gain = sounds.gainplayers[name][sound_type]
|
||||||
|
if gain == nil then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
return gain/50
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function load_sounds_config()
|
local function load_sounds_config()
|
||||||
local input = io.open(sounds.file, "r")
|
local file = io.open(sounds.file, "r")
|
||||||
if input then
|
if file then
|
||||||
repeat
|
sounds.gainplayers = minetest.deserialize(file:read("*all"))
|
||||||
local musique = input:read("*n")
|
file:close()
|
||||||
if musique == nil then
|
end
|
||||||
break
|
if sounds.gainplayers == nil then
|
||||||
end
|
sounds.gainplayers = {}
|
||||||
local ambience = input:read("*n")
|
|
||||||
|
|
||||||
local mobs = input:read("*n")
|
|
||||||
|
|
||||||
local other = input:read("*n")
|
|
||||||
|
|
||||||
local name = input:read("*l")
|
|
||||||
|
|
||||||
sounds.gainplayers[name:sub(2)] = {musique = musique, ambience = ambience, mobs = mobs, other = other}
|
|
||||||
until input:read(0) == nil
|
|
||||||
io.close(input)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -84,24 +84,24 @@ end
|
||||||
load_sounds_config()
|
load_sounds_config()
|
||||||
|
|
||||||
minetest.register_chatcommand("setsound", {
|
minetest.register_chatcommand("setsound", {
|
||||||
params = "",
|
params = "<music|ambience|mobs|other> <number>",
|
||||||
description = "set volume sound <musique|ambience|mobs|other>",
|
description = "set volume sound <music|ambience|mobs|other>",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = sounds.set_sound,
|
func = sounds.set_sound,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_chatcommand("getsound", {
|
minetest.register_chatcommand("getsound", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "print volume sound <musique|ambience|mobs|other>",
|
description = "print volume sound <music|ambience|mobs|other>",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local conf = ""
|
local conf = ""
|
||||||
for k, v in pairs(sounds.gainplayers[name]) do
|
for k, v in pairs(sounds.gainplayers[name]) do
|
||||||
conf = conf .. " " .. k .. ":" .. v
|
conf = conf .. " " .. k .. ":" .. v
|
||||||
end
|
end
|
||||||
minetest.chat_send_player(name, "sounds conf " .. conf)
|
minetest.chat_send_player(name, "sounds conf " .. conf)
|
||||||
minetest.log("action","Player ".. name .. " sound conf " .. conf)
|
minetest.log("action","Player ".. name .. " sound conf " .. conf)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-= soundset-MOD for MINETEST =-
|
-= soundset-MOD for MINETEST =-
|
||||||
by Mg and crabman77
|
by LeMagnesium and crabman77
|
||||||
|
|
||||||
YOUR mod can use THIS mod to have a volume that's adjustable by the player(s)
|
YOUR mod can use THIS mod to have a volume that's adjustable by the player(s)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user