use same gain on all sounds
in preparation for individualized volume settings
This commit is contained in:
parent
9cd3736197
commit
8a6d034ef5
@ -70,7 +70,7 @@ local create_channel = {
|
||||
minetest.write_json(beerchat.playersChannels[lowner])
|
||||
)
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = lowner, gain = 1.0 } )
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = lowner, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
minetest.chat_send_player(lowner, beerchat.format_message(channel_created_string, { channel_name = lchannel_name }))
|
||||
|
||||
@ -110,7 +110,7 @@ local delete_channel = {
|
||||
)
|
||||
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = 1.0 } )
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
|
||||
minetest.chat_send_player(
|
||||
@ -130,13 +130,13 @@ local my_channels = {
|
||||
func = function(name, param)
|
||||
if not param or param == "" then
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = 1.0 } )
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
minetest.chat_send_player(name, dump2(beerchat.playersChannels[name]))
|
||||
else
|
||||
if beerchat.playersChannels[name][param] then
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = 1.0 } )
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
minetest.chat_send_player(name, dump2(beerchat.channels[param]))
|
||||
else
|
||||
@ -186,7 +186,7 @@ local join_channel = {
|
||||
)
|
||||
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(join_channel_sound, { to_player = name, gain = 1.0 } )
|
||||
minetest.sound_play(join_channel_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
minetest.chat_send_player(name, beerchat.format_message(channel_joined_string, { channel_name = channel_name }))
|
||||
|
||||
@ -218,7 +218,7 @@ local leave_channel = {
|
||||
)
|
||||
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(leave_channel_sound, { to_player = name, gain = 1.0 } )
|
||||
minetest.sound_play(leave_channel_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
if not beerchat.channels[channel_name] then
|
||||
minetest.chat_send_player(
|
||||
@ -269,7 +269,7 @@ local invite_channel = {
|
||||
else
|
||||
if not beerchat.has_player_muted_player(player_name, name) then
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(channel_invite_sound, { to_player = player_name, gain = 1.0 } )
|
||||
minetest.sound_play(channel_invite_sound, { to_player = player_name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
-- Sending the message
|
||||
minetest.chat_send_player(
|
||||
@ -278,7 +278,7 @@ local invite_channel = {
|
||||
)
|
||||
end
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(channel_invite_sound, { to_player = name, gain = 1.0 } )
|
||||
minetest.sound_play(channel_invite_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
minetest.chat_send_player(
|
||||
name,
|
||||
|
@ -18,7 +18,7 @@ beerchat.send_message = function(name, message, channel)
|
||||
minetest.chat_send_player(name, message)
|
||||
-- TODO: read player settings for channel sounds
|
||||
if beerchat.enable_sounds and channel ~= beerchat.main_channel_name then
|
||||
minetest.sound_play(beerchat.channel_message_sound, { to_player = name, gain = 0.3 } )
|
||||
minetest.sound_play(beerchat.channel_message_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
end -- send_message
|
||||
|
||||
|
2
hash.lua
2
hash.lua
@ -100,7 +100,7 @@ minetest.register_on_chat_message(function(name, message)
|
||||
end
|
||||
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = 1.0 } )
|
||||
minetest.sound_play(beerchat.channel_management_sound, { to_player = name, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
3
init.lua
3
init.lua
@ -12,6 +12,9 @@ beerchat = {
|
||||
-- Global flag to enable/ disable sounds
|
||||
enable_sounds = true,
|
||||
|
||||
-- how loud the sounds should be by default (0.0 = low, 1.0 = max)
|
||||
sounds_default_gain = 0.3,
|
||||
|
||||
-- General sound when managing channels like /cc, /dc etc
|
||||
channel_management_sound = "beerchat_chirp",
|
||||
|
||||
|
8
pm.lua
8
pm.lua
@ -42,7 +42,7 @@ minetest.register_on_chat_message(function(name, message)
|
||||
)
|
||||
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(private_message_sound, { to_player = target, gain = 1.0 } )
|
||||
minetest.sound_play(private_message_sound, { to_player = target, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(
|
||||
@ -57,7 +57,7 @@ minetest.register_on_chat_message(function(name, message)
|
||||
)
|
||||
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(self_message_sound, { to_player = target, gain = 1.0 } )
|
||||
minetest.sound_play(self_message_sound, { to_player = target, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -112,7 +112,7 @@ local send_pm = function(players, name, msg)
|
||||
)
|
||||
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(private_message_sound, { to_player = target, gain = 1.0 } )
|
||||
minetest.sound_play(private_message_sound, { to_player = target, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(
|
||||
@ -125,7 +125,7 @@ local send_pm = function(players, name, msg)
|
||||
)
|
||||
)
|
||||
if beerchat.enable_sounds then
|
||||
minetest.sound_play(self_message_sound, { to_player = target, gain = 1.0 } )
|
||||
minetest.sound_play(self_message_sound, { to_player = target, gain = beerchat.sounds_default_gain } )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user