Add a "pvpplus.enable_sound_loop" setting & Play the tournament_end sound
parent
5b6f9ddb54
commit
68bd3b5e49
|
@ -17,6 +17,10 @@ Some additional commands are only executable by the players possessing the `tour
|
|||
* `/remove_from_tournament <name>`: removes a player from the current tournament
|
||||
* `/add_to_tournament <name>`: adds a player to the current tournament
|
||||
|
||||
## Settings
|
||||
|
||||
* `pvpplus.enable_sound_loop = true`: whether to play a looped epic music during the tournament
|
||||
|
||||
## API
|
||||
|
||||
```lua
|
||||
|
|
|
@ -82,14 +82,15 @@ function pvpplus.start_tournament(starter_name)
|
|||
to_player = player,
|
||||
gain = 1.0,
|
||||
})
|
||||
minetest.after(10, function(name)
|
||||
tournament.sound_handles[name] = minetest.sound_play("pvpplus_tournament_loop", {
|
||||
to_player = name,
|
||||
gain = 1.0,
|
||||
loop = true,
|
||||
})
|
||||
end, player)
|
||||
|
||||
if minetest.setting_getbool("pvpplus.enable_sound_loop") ~= false then -- If it's true or nil (unset)
|
||||
minetest.after(10, function(name)
|
||||
tournament.sound_handles[name] = minetest.sound_play("pvpplus_tournament_loop", {
|
||||
to_player = name,
|
||||
gain = 1.0,
|
||||
loop = true,
|
||||
})
|
||||
end, player)
|
||||
end
|
||||
end
|
||||
chat_message = chat_message:sub(0, -3) -- Remove the last ', '
|
||||
tournament.engaged_players = {}
|
||||
|
@ -140,6 +141,10 @@ function pvpplus.stop_tournament()
|
|||
if tournament.sound_handles[name] then
|
||||
minetest.sound_stop(tournament.sound_handles[name])
|
||||
end
|
||||
minetest.sound_play("pvpplus_tournament_end", {
|
||||
to_player = name,
|
||||
gain = 1.0,
|
||||
})
|
||||
end
|
||||
table.sort(rating, function(a, b) return a.score > b.score end)
|
||||
|
||||
|
|
Loading…
Reference in New Issue