mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
Added to play a sound for every player when a player die
This commit is contained in:
parent
0b51e1f7ac
commit
27b925f996
@ -12,7 +12,7 @@ local messages = {}
|
||||
|
||||
-- Fill this table with sounds
|
||||
local sounds = {
|
||||
[1] = "death_messages_death_1",
|
||||
[1] = "death_messages_player_1",
|
||||
}
|
||||
|
||||
-- Lava death messages
|
||||
@ -60,6 +60,16 @@ messages.other = {
|
||||
" a perdu la vie."
|
||||
}
|
||||
|
||||
|
||||
local function sound_play_all(dead)
|
||||
for _, p in ipairs(minetest.get_connected_players()) do
|
||||
local player_name = p:get_player_name()
|
||||
if player_name and player_name ~= dead then
|
||||
minetest.sound_play({name="death_messages_people_1", to_player=player_name, gain=0.5*soundset.get_gain(player_name,"other")})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if RANDOM_MESSAGES == true then
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
@ -83,7 +93,8 @@ if RANDOM_MESSAGES == true then
|
||||
else
|
||||
minetest.chat_send_all(player_name .. messages.other[math.random(1,#messages.other)] )
|
||||
end
|
||||
minetest.sound_play({name = sounds[math.random(1,#sounds)],gain=0.5*soundset.get_gain(player:get_player_name(),"other")})
|
||||
minetest.sound_play({name = sounds[math.random(1,#sounds)],to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player:get_player_name(),"other")})
|
||||
sound_play_all(player:get_player_name())
|
||||
end)
|
||||
|
||||
else
|
||||
@ -106,7 +117,8 @@ else
|
||||
else
|
||||
minetest.chat_send_all(player_name .. " died.")
|
||||
end
|
||||
minetest.sound_play({name = sounds[math.random(1,#sounds)],gain=0.5*soundset.get_gain(player:get_player_name(),"other")})
|
||||
minetest.sound_play({name = sounds[math.random(1,#sounds)],to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player:get_player_name(),"other")})
|
||||
sound_play_all(player:get_player_name())
|
||||
end)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user