Merge branch 'audio_lib' into 'master'

Use audio_lib

Closes #106

See merge request zughy-friends-minetest/block_league!44
This commit is contained in:
Zughy 2024-02-16 14:43:12 +00:00
commit 507737eede
32 changed files with 295 additions and 69 deletions

View File

@ -2,6 +2,10 @@
# author(s): Wuzzy
# reviewer(s):
##[ src/_load.lua ]##
Sentry explodes=
Sentry spawns=
##[ src/nodes.lua ]##
BL Tutorial=BL-Einführung
Floor edge @1=Bodenkante @1

View File

@ -2,6 +2,10 @@
# author(s): Zughy
# reviewer(s):
##[ src/_load.lua ]##
Sentry explodes=
Sentry spawns=
##[ src/nodes.lua ]##
BL Tutorial=Tutorial BL
Floor edge @1=Borde piso @1

View File

@ -2,6 +2,10 @@
# author(s): nyomi
# reviewer(s):
##[ src/_load.lua ]##
Sentry explodes=
Sentry spawns=
##[ src/nodes.lua ]##
BL Tutorial=
Floor edge @1=

View File

@ -2,6 +2,10 @@
# author(s): Zughy
# reviewer(s):
##[ src/_load.lua ]##
Sentry explodes=Torretta esplode
Sentry spawns=Torretta appare
##[ src/nodes.lua ]##
BL Tutorial=Tutorial BL
Floor edge @1=Bordo pavimento @1

View File

@ -2,6 +2,10 @@
# author(s): Szkodnix
# reviewer(s):
##[ src/_load.lua ]##
Sentry explodes=
Sentry spawns=
##[ src/nodes.lua ]##
BL Tutorial=Samouczek LB
Floor edge @1=Krawędź bloku @1

View File

@ -2,6 +2,10 @@
# author(s): vintprox
# reviewer(s):
##[ src/_load.lua ]##
Sentry explodes=
Sentry spawns=
##[ src/nodes.lua ]##
BL Tutorial=Обучение БЛ
Floor edge @1=Край пола @1

View File

@ -2,6 +2,10 @@
# author(s):
# reviewer(s):
##[ src/_load.lua ]##
Sentry explodes=
Sentry spawns=
##[ src/nodes.lua ]##
BL Tutorial=
Floor edge @1=

View File

@ -1,3 +1,7 @@
local S = minetest.get_translator("block_league")
local function load_schematic()
local src_dir = minetest.get_modpath("bl_tutorial") .. "/schems"
local wrld_dir = minetest.get_worldpath() .. "/schems"
@ -17,5 +21,13 @@ local function load_schematic()
io.close(mod_schem)
end
load_schematic()
load_schematic()
----------------------------------------------
------------------AUDIO_LIB-------------------
----------------------------------------------
audio_lib.register_sound("sfx", "bl_tutorial_sentry_death", S("Sentry explodes"))
audio_lib.register_sound("sfx", "bl_tutorial_sentry_spawn", S("Sentry spawns"))

View File

@ -63,7 +63,7 @@ function ball:attach(player)
self.p_name = p_name
minetest.sound_play("bl_crowd_cheer", {to_player = p_name})
arena_lib.sound_play(p_name, "bl_crowd_cheer")
block_league.HUD_ball_update(p_name, extS("You've got the ball!"), "0xabf877")
player:get_meta():set_int("bl_has_ball", 1)
@ -81,7 +81,7 @@ function ball:reset()
local p_name = self.p_name
-- annuncio
minetest.sound_play("bl_voice_ball_reset", {to_player = p_name})
arena_lib.sound_play(p_name, "bl_voice_ball_reset")
block_league.HUD_ball_update(p_name, extS("Ball reset"))
local wielder = minetest.get_player_by_name(p_name)

View File

@ -15,7 +15,7 @@ local obstacle = {
local p_name = killer:get_player_name()
if not arena_lib.is_player_in_arena(p_name) then return end
minetest.sound_play("bl_tutorial_sentry_death", {object = self.object, max_hear_distance = 20})
audio_lib.play_sfx("bl_tutorial_sentry_death", {object = self.object, max_hear_distance = 20})
bl_tutorial.decrease_obstacles(p_name)
end,
}

View File

@ -26,7 +26,7 @@ local sentry = {
on_activate = function(self)
local sentry = self.object
sentry:set_animation({x=120, y=130}, 20, nil, false)
minetest.sound_play("bl_tutorial_sentry_spawn", {gain = 0.2, pitch = 1.15, object = sentry, max_hear_distance = SENTRY_RANGE + 5})
audio_lib.play_sfx("bl_tutorial_sentry_spawn", {gain = 0.2, pitch = 1.15, object = sentry, max_hear_distance = SENTRY_RANGE + 5})
minetest.after(1.2, function()
if not self.object then return end
self.object:set_animation({x=1, y=100}, 20)
@ -92,7 +92,7 @@ local sentry = {
entity:set_animation({x=112, y=115}, 25, nil, false)
self.dying = true
minetest.sound_play("bl_tutorial_sentry_death", {object = entity, max_hear_distance = SENTRY_RANGE + 5})
audio_lib.play_sfx("bl_tutorial_sentry_death", {object = entity, max_hear_distance = SENTRY_RANGE + 5})
minetest.add_particlespawner({
attached = self.object,
amount = 200,
@ -148,7 +148,7 @@ function rotate_and_shoot(sentry, dir)
local pointed_object = block_league.get_pointed_objects(sentry, 20, false, {height = sentry_centre, dir = dir})
draw_particles(dir, vector.add(sentry:get_pos(), vector.new(0, sentry_centre, 0)))
minetest.sound_play("bl_smg_shoot", {pitch = 2.3, object = sentry, max_hear_distance = SENTRY_RANGE + 5})
audio_lib.play_sfx("bl_smg_shoot", {pitch = 2.3, object = sentry, max_hear_distance = SENTRY_RANGE + 5})
if next(pointed_object) then
local target = pointed_object[1].object

View File

@ -445,7 +445,7 @@ function phase6(player)
remove_entities(future_ball_pos, 3, "bl_tutorial:ball")
minetest.sound_play("bl_crowd_cheer", {to_player = p_name})
arena_lib.sound_play(p_name, "bl_crowd_cheer")
block_league.HUD_scoreboard_update_score(arena)
-- metto a 0 dato che la metto a 99 all'inizio di ogni fase. Così blocca stamina_drain,

View File

@ -7,7 +7,7 @@ local NS = function(s) return s end
block_league = {}
dofile(modpath .. "/GLOBALS.lua")
dofile(srcpath .. "/_load.lua")
arena_lib.register_minigame("block_league", {

View File

@ -32,6 +32,27 @@ Deaths=Tode
Team=Team
Points=Punkte
##[ src/_load.lua ]##
Voices=
Sad crowd=
Confirmation sound=
Hits target=
"Critical!"=
Victory jingle=
Sad trombone=
Ding!=
Pixelgun reloads=
Pixelgun shoots=
Boing=
SMG reloads=
SMG shoots=
SMG shoots (2)=
Sword swings=
Dashes=
"Fight!"=
"Ball reset"=
"3, 2, 1..."=
##[ src/arena_lib/arena_editor.lua ]##
Mode, waiting rooms and more=Modus, Warteräume und mehr
Change mode (LMB TD, RMB DM)=Modus wechseln (LMT TD, RMT DM)
@ -43,6 +64,10 @@ Set minimum Y (death below)=Minimales Y setzen (darunter@=Tod)
##[ src/arena_lib/on_death.lua ]##
Back in the game in @1=Zurück im Spiel in @1
##[ src/arena_lib/on_enable.lua ]##
This mode forcibly requires teams to work!=
This mode forcibly requires no teams to work!=
##[ src/arena_lib/on_entering.lua ]##
The game will start soon=Das Spiel beginnt gleich

View File

@ -32,6 +32,27 @@ Deaths=Muertes
Team=Equipo
Points=Puntos
##[ src/_load.lua ]##
Voices=
Sad crowd=
Confirmation sound=
Hits target=
"Critical!"=
Victory jingle=
Sad trombone=
Ding!=
Pixelgun reloads=
Pixelgun shoots=
Boing=
SMG reloads=
SMG shoots=
SMG shoots (2)=
Sword swings=
Dashes=
"Fight!"=
"Ball reset"=
"3, 2, 1..."=
##[ src/arena_lib/arena_editor.lua ]##
Mode, waiting rooms and more=Modo, salas de espera y más
Change mode (LMB TD, RMB DM)=Cambia modo (clic izdo Ensayo, dcho DM)
@ -43,6 +64,10 @@ Set minimum Y (death below)=Pon Y mínima (muerte abajo)
##[ src/arena_lib/on_death.lua ]##
Back in the game in @1=De vuelta al juego en @1
##[ src/arena_lib/on_enable.lua ]##
This mode forcibly requires teams to work!=
This mode forcibly requires no teams to work!=
##[ src/arena_lib/on_entering.lua ]##
The game will start soon=El juego comenzará pronto

View File

@ -32,6 +32,27 @@ Deaths=Halál
Team=Csapat
Points=Pontok
##[ src/_load.lua ]##
Voices=
Sad crowd=
Confirmation sound=
Hits target=
"Critical!"=
Victory jingle=
Sad trombone=
Ding!=
Pixelgun reloads=
Pixelgun shoots=
Boing=
SMG reloads=
SMG shoots=
SMG shoots (2)=
Sword swings=
Dashes=
"Fight!"=
"Ball reset"=
"3, 2, 1..."=
##[ src/arena_lib/arena_editor.lua ]##
Mode, waiting rooms and more=
Change mode (LMB TD, RMB DM)=
@ -43,6 +64,10 @@ Set minimum Y (death below)=
##[ src/arena_lib/on_death.lua ]##
Back in the game in @1=Visza a játékba @1-ben
##[ src/arena_lib/on_enable.lua ]##
This mode forcibly requires teams to work!=
This mode forcibly requires no teams to work!=
##[ src/arena_lib/on_entering.lua ]##
The game will start soon=A játék hamarosan kezdődik

View File

@ -32,6 +32,27 @@ Deaths=Morti
Team=Squadra
Points=Punti
##[ src/_load.lua ]##
Voices=Voci
Sad crowd=Folla si abbatte
Confirmation sound=Suono di conferma
Hits target=Colpo inflitto
"Critical!"="Critico!"
Victory jingle=Motivetto di vittoria
Sad trombone=Trombone triste
Ding!=Ding!
Pixelgun reloads=Pixelgun ricarica
Pixelgun shoots=Pixelgun spara
Boing=Boing
SMG reloads=Mitraglietta ricarica
SMG shoots=Mitraglietta spara
SMG shoots (2)=Mitraglietta spara (2)
Sword swings=Spada fende
Dashes=Scatto
"Fight!"="Combatti!"
"Ball reset"="Palla ripristinata"
"3, 2, 1..."="3, 2, 1..."
##[ src/arena_lib/arena_editor.lua ]##
Mode, waiting rooms and more=Modalità, sale d'attesa e altro
Change mode (LMB TD, RMB DM)=Cambia modalità (sx TD, dx DM)
@ -43,6 +64,10 @@ Set minimum Y (death below)=Imposta Y minima (morte al di sotto)
##[ src/arena_lib/on_death.lua ]##
Back in the game in @1=Di nuovo in partita tra @1
##[ src/arena_lib/on_enable.lua ]##
This mode forcibly requires teams to work!=
This mode forcibly requires no teams to work!=
##[ src/arena_lib/on_entering.lua ]##
The game will start soon=La partita comincerà a breve

View File

@ -32,6 +32,27 @@ Deaths=Śmierci
Team=Drużyna
Points=Punkty
##[ src/_load.lua ]##
Voices=
Sad crowd=
Confirmation sound=
Hits target=
"Critical!"=
Victory jingle=
Sad trombone=
Ding!=
Pixelgun reloads=
Pixelgun shoots=
Boing=
SMG reloads=
SMG shoots=
SMG shoots (2)=
Sword swings=
Dashes=
"Fight!"=
"Ball reset"=
"3, 2, 1..."=
##[ src/arena_lib/arena_editor.lua ]##
Mode, waiting rooms and more=Tryb, poczekalnie i inne
Change mode (LMB TD, RMB DM)=Zmień tryb (LPM TD, PPM DM)
@ -43,6 +64,10 @@ Set minimum Y (death below)=Ustaw minimalne Y (poniżej śmierć)
##[ src/arena_lib/on_death.lua ]##
Back in the game in @1=Powrót do gry za @1
##[ src/arena_lib/on_enable.lua ]##
This mode forcibly requires teams to work!=
This mode forcibly requires no teams to work!=
##[ src/arena_lib/on_entering.lua ]##
The game will start soon=Gra zaraz się rozpocznie

View File

@ -34,6 +34,27 @@ Deaths=Смертей
Team=Команда
Points=Очков
##[ src/_load.lua ]##
Voices=
Sad crowd=
Confirmation sound=
Hits target=
"Critical!"=
Victory jingle=
Sad trombone=
Ding!=
Pixelgun reloads=
Pixelgun shoots=
Boing=
SMG reloads=
SMG shoots=
SMG shoots (2)=
Sword swings=
Dashes=
"Fight!"=
"Ball reset"=
"3, 2, 1..."=
##[ src/arena_lib/arena_editor.lua ]##
Mode, waiting rooms and more=Режим, комнаты ожидания и более
Change mode (LMB TD, RMB DM)=Сменить режим (ЛКМ TD, ПКМ DM)
@ -45,6 +66,10 @@ Set minimum Y (death below)=Установить минимальную Y (см
##[ src/arena_lib/on_death.lua ]##
Back in the game in @1=Возврат в игру через @1
##[ src/arena_lib/on_enable.lua ]##
This mode forcibly requires teams to work!=
This mode forcibly requires no teams to work!=
##[ src/arena_lib/on_entering.lua ]##
The game will start soon=Игра начнётся скоро

View File

@ -32,6 +32,27 @@ Deaths=
Team=
Points=
##[ src/_load.lua ]##
Voices=
Sad crowd=
Confirmation sound=
Hits target=
"Critical!"=
Victory jingle=
Sad trombone=
Ding!=
Pixelgun reloads=
Pixelgun shoots=
Boing=
SMG reloads=
SMG shoots=
SMG shoots (2)=
Sword swings=
Dashes=
"Fight!"=
"Ball reset"=
"3, 2, 1..."=
##[ src/arena_lib/arena_editor.lua ]##
Mode, waiting rooms and more=
Change mode (LMB TD, RMB DM)=
@ -43,6 +64,10 @@ Set minimum Y (death below)=
##[ src/arena_lib/on_death.lua ]##
Back in the game in @1=
##[ src/arena_lib/on_enable.lua ]##
This mode forcibly requires teams to work!=
This mode forcibly requires no teams to work!=
##[ src/arena_lib/on_entering.lua ]##
The game will start soon=

View File

@ -227,7 +227,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local skill = "block_league:" .. player:get_meta():get_string("bl_profile_elem_active")
block_league.set_player_skill(p_name, skill)
minetest.sound_play("bl_gui_equip_confirm", {to_player = p_name})
audio_lib.play_sfx("bl_gui_equip_confirm", {to_player = p_name})
end
minetest.show_formspec(p_name, "block_league:profile", get_formspec(p_name))

View File

@ -62,7 +62,6 @@ end
function block_league.HUD_log_update(arena, action_img, executor, receiver, assister)
for psp_name, _ in pairs(arena.players_and_spectators) do
local panel = panel_lib.get_panel(psp_name, "bl_log")
local executor_color, receiver_color

View File

@ -0,0 +1,27 @@
local S = minetest.get_translator("block_league")
----------------------------------------------
------------------AUDIO_LIB-------------------
----------------------------------------------
audio_lib.register_type("block_league", "voices", S("Voices"))
audio_lib.register_sound("sfx", "bl_crowd_cheer", S("Sad crowd"))
audio_lib.register_sound("sfx", "bl_crowd_ohno", S("Sad crowd"))
audio_lib.register_sound("sfx", "bl_gui_equip_confirm", S("Confirmation sound"))
audio_lib.register_sound("sfx", "bl_hit", S("Hits target"))
audio_lib.register_sound("sfx", "bl_jingle_victory", S("Victory jingle"))
audio_lib.register_sound("sfx", "bl_jingle_defeat", S("Sad trombone"))
audio_lib.register_sound("sfx", "bl_kill", S("Ding!"))
audio_lib.register_sound("sfx", "bl_pixelgun_reload", S("Pixelgun reloads"))
audio_lib.register_sound("sfx", "bl_pixelgun_shoot", S("Pixelgun shoots"))
audio_lib.register_sound("sfx", "bl_propulsor_bounce", S("Boing"))
audio_lib.register_sound("sfx", "bl_smg_reload", S("SMG reloads"))
audio_lib.register_sound("sfx", "bl_smg_shoot", S("SMG shoots"))
audio_lib.register_sound("sfx", "bl_smg_shoot", S("SMG shoots (2)"))
audio_lib.register_sound("sfx", "bl_sword_hit", S("Sword swings"))
audio_lib.register_sound("sfx", "bl_sword_dash", S("Dashes"))
audio_lib.register_sound("voices", "bl_voice_critical", S("\"Critical!\""), {ephemeral = false, cant_overlap = true})
audio_lib.register_sound("voices", "bl_voice_fight", S("\"Fight!\""))
audio_lib.register_sound("voices", "bl_voice_ball_reset", S("\"Ball reset\""))
audio_lib.register_sound("voices", "bl_voice_countdown_3", S("\"3, 2, 1...\""), {ephemeral = false})

View File

@ -9,23 +9,17 @@ arena_lib.on_celebration("block_league", function(arena, winners)
panel_lib.get_panel(pl_name, "bl_info_panel"):show()
arena_lib.HUD_hide("broadcast", pl_name)
audio_lib.stop_sound(pl_name, "bl_voice_countdown_3") -- in case of people quitting before the match starts
end
-- se è pareggio, passa una stringa (no one)
local is_tie = type(winners) == "string" and true
if not is_tie then
for pl_name, pl_stats in pairs(arena.players) do
if pl_stats.teamID == winners then
minetest.sound_play("bl_jingle_victory", {to_player = pl_name})
else
minetest.sound_play("bl_jingle_defeat", {to_player = pl_name})
end
end
local losers = winners == 1 and 2 or 1
arena_lib.sound_play_team(arena, winners, "bl_jingle_victory")
arena_lib.sound_play_team(arena, losers, "bl_jingle_defeat")
else
for pl_name, pl_stats in pairs(arena.players) do
minetest.sound_play("bl_jingle_victory", {to_player = pl_name})
end
arena_lib.sound_play_all(arena, "bl_jingle_victory")
end
end)

View File

@ -63,7 +63,7 @@ arena_lib.on_join("block_league", function(p_name, arena, as_spectator, was_spec
block_league.HUD_spectate_addplayer(arena, p_name)
block_league.refill_weapons(arena, p_name)
minetest.sound_play("bl_voice_fight", {to_player = p_name})
arena_lib.sound_play(p_name, "bl_voice_fight")
minetest.after(0.1, function()
block_league.info_panel_update_all(arena)

View File

@ -2,6 +2,7 @@ local S = minetest.get_translator("block_league")
local function remove_HUD() end
local function remove_spectate_HUD() end
local function stop_sounds() end
@ -18,6 +19,7 @@ arena_lib.on_end("block_league", function(arena, winners, is_forced)
-- the fact you can zoom during the loading phase)
block_league.deactivate_zoom(minetest.get_player_by_name(pl_name))
remove_HUD(pl_name)
stop_sounds(pl_name)
pl_name:get_skill(block_league.get_player_skill(pl_name)):disable()
--block_league.update_storage(pl_name)
@ -57,6 +59,8 @@ arena_lib.on_quit("block_league", function(arena, p_name, is_spectator, reason)
remove_spectate_HUD(arena, p_name, is_spectator)
remove_HUD(p_name, is_spectator)
stop_sounds(p_name)
p_name:get_skill(block_league.get_player_skill(p_name)):disable()
if arena.mode == 0 then
@ -102,3 +106,9 @@ function remove_spectate_HUD(arena, p_name, is_spectator)
block_league.HUD_spectate_removeplayer(arena, p_name)
end
end
function stop_sounds(p_name)
audio_lib.stop_sound(p_name, "bl_voice_countdown_3")
end

View File

@ -200,8 +200,9 @@ function ball:reset()
local arena = self.arena
-- annuncio
arena_lib.sound_play_all(arena, "bl_voice_ball_reset")
for psp_name, _ in pairs(arena.players_and_spectators) do
minetest.sound_play("bl_voice_ball_reset", {to_player = psp_name})
block_league.HUD_ball_update(psp_name, S("Ball reset"))
end
@ -234,13 +235,14 @@ function ball:announce_ball_possession_change(is_ball_lost)
local enemy_team = arena_lib.get_players_in_team(arena, enemy_teamID)
if is_ball_lost then
arena_lib.sound_play_team(arena, teamID, "bl_crowd_ohno")
arena_lib.sound_play_team(arena, enemy_teamID, "bl_crowd_cheer")
for _, pl_name in pairs(team) do
minetest.sound_play("bl_crowd_ohno", {to_player = pl_name})
block_league.HUD_ball_update(pl_name, S("Your team has lost the ball!"), "0xff8e8e")
end
for _, pl_name in pairs(enemy_team) do
minetest.sound_play("bl_crowd_cheer", {to_player = pl_name})
block_league.HUD_ball_update(pl_name, S("Enemy team has lost the ball!"), "0xabf877")
end
@ -248,14 +250,15 @@ function ball:announce_ball_possession_change(is_ball_lost)
local p_name = self.p_name
block_league.HUD_log_update(arena, "bl_log_ball.png", p_name, "")
arena_lib.sound_play_team(arena, teamID, "bl_crowd_cheer")
arena_lib.sound_play_team(arena, enemy_teamID, "bl_crowd_ohno")
for _, pl_name in pairs(team) do
minetest.sound_play("bl_crowd_cheer", {to_player = pl_name})
block_league.HUD_ball_update(pl_name, S("Your team has got the ball!"), "0xabf877")
end
block_league.HUD_ball_update(p_name, S("You've got the ball!"), "0xabf877")
for _, pl_name in pairs(enemy_team) do
minetest.sound_play("bl_crowd_ohno", {to_player = pl_name})
block_league.HUD_ball_update(pl_name, S("Enemy team has got the ball!"), "0xff8e8e")
end
end
@ -319,19 +322,19 @@ function add_point(p_name, teamID, arena)
local enemy_team = arena_lib.get_players_in_team(arena, enemy_teamID)
for _, pl_name in pairs(team) do
minetest.sound_play("bl_crowd_cheer", {to_player = pl_name})
audio_lib.play_sfx("bl_crowd_cheer", {to_player = pl_name})
block_league.HUD_ball_update(pl_name, S("NICE POINT!"), "0xabf877")
end
for _, pl_name in pairs(enemy_team) do
minetest.sound_play("bl_crowd_ohno", {to_player = pl_name})
audio_lib.play_sfx("bl_crowd_ohno", {to_player = pl_name})
block_league.HUD_ball_update(pl_name, S("ENEMY TEAM HAS SCORED..."), "0xff8e8e")
end
local scoring_team_color = teamID == 1 and "0xf2a05b" or "0x55aef1"
for sp_name, _ in pairs(arena.spectators) do
minetest.sound_play("bl_crowd_cheer", {to_player = sp_name})
audio_lib.play_sfx("bl_crowd_cheer", {to_player = sp_name})
block_league.HUD_ball_update(sp_name, "TOUCHDOWN!", scoring_team_color)
end

View File

@ -6,9 +6,8 @@ local function load_ball() end
function block_league.countdown_and_start(arena, time)
minetest.after(3, function()
for psp_name, _ in pairs(arena.players_and_spectators) do
minetest.sound_play("bl_voice_countdown_" .. time, {to_player = psp_name})
end
if arena.in_celebration then return end
arena_lib.sound_play_all(arena, "bl_voice_countdown_3")
display_and_start_countdown(arena, time)
end)
end
@ -16,7 +15,7 @@ end
function block_league.refill_weapons(arena, p_name)
for i, w_name in pairs(block_league.get_player_weapons(p_name)) do
for _, w_name in pairs(block_league.get_player_weapons(p_name)) do
local magazine = minetest.registered_nodes[w_name].magazine
if magazine then
@ -35,11 +34,13 @@ end
----------------------------------------------
function display_and_start_countdown(arena, time_left)
if time_left > 0 then
arena_lib.HUD_send_msg_all("broadcast", arena, time_left)
time_left = time_left -1
minetest.after(1, function() display_and_start_countdown(arena, time_left) end)
minetest.after(1, function()
if arena.in_celebration then return end
display_and_start_countdown(arena, time_left)
end)
else
arena_lib.HUD_hide("broadcast", arena)
round_start(arena)
@ -69,10 +70,7 @@ function round_start(arena)
block_league.HUD_spectate_update(arena, pl_name, "alive")
end
for psp_name, _ in pairs(arena.players_and_spectators) do
minetest.sound_play("bl_voice_fight", {to_player = psp_name})
end
arena_lib.sound_play_all(arena, "bl_voice_fight")
block_league.HUD_log_clear(arena)
if arena.mode == 1 then

View File

@ -14,26 +14,6 @@ end
function block_league.sound_play(sound, p_name, not_overlappable)
local handle = minetest.sound_play(sound, {to_player = p_name})
if not_overlappable then
stop_and_update_last_sound(p_name, sound, handle)
end
if arena_lib.is_player_spectated(p_name) then
for sp_name, _ in pairs(arena_lib.get_player_spectators(p_name)) do
handle = minetest.sound_play(sound, {to_player = sp_name})
if not_overlappable then
stop_and_update_last_sound(sp_name, sound, handle)
end
end
end
end
-- interrompi l'ultimo suono chiamato "sound" e lo aggiorna a quello passatogli
function stop_and_update_last_sound(p_name, sound, handle)
sounds[p_name] = sounds[p_name] or {}

View File

@ -32,7 +32,7 @@ local function register_propulsor(name, desc, stamina)
local knockback = user:get_velocity().y < 1 and -15 or -10
user:add_velocity(vector.multiply(dir, knockback))
block_league.sound_play("bl_propulsor_bounce", p_name)
arena_lib.sound_play(p_name, "bl_propulsor_bounce")
end,
on_secondary_use = function(itemstack, user, pointed_thing)
@ -76,7 +76,7 @@ function dash(player, stamina)
local dash_dir = vector.rotate_around_axis(minetest.yaw_to_dir(look_horizontal), {x=0,y=1,z=0}, rotate_factor)
player:add_velocity(vector.multiply(dash_dir, 16))
block_league.sound_play("bl_sword_dash", p_name)
arena_lib.sound_play(p_name, "bl_sword_dash")
end

View File

@ -164,7 +164,7 @@ function block_league.apply_damage(user, targets, weapon, action)
if headshot and action.type ~= "melee" then
damage = damage * 1.5
block_league.HUD_critical_show(p_name)
block_league.sound_play("bl_hit_critical", p_name, true)
arena_lib.sound_play(p_name, "bl_voice_critical")
end
-- eventuale danno decrementato a seconda della distanza
@ -189,7 +189,7 @@ function block_league.apply_damage(user, targets, weapon, action)
-- se è ancora vivo, riproduco suono danno
if target:get_hp() > 0 then
block_league.sound_play("bl_hit", p_name)
arena_lib.sound_play(p_name, "bl_hit")
-- sennò kaputt
else
if is_player then -- TODO: dovrebbe valere anche per le torrette, ma c'è troppo da cambiare al momento
@ -214,7 +214,7 @@ function block_league.kill(arena, weapon, player, target)
local t_name = target:get_player_name()
-- riproduco suono morte e aggiorno avatar per spettatorɜ
block_league.sound_play("bl_kill", p_name)
arena_lib.sound_play(p_name, "bl_kill")
block_league.HUD_spectate_update(arena, t_name, "alive")
if t_name ~= p_name then
@ -271,7 +271,7 @@ function block_league.kill(arena, weapon, player, target)
-- ..e se esiste, esegui tutte le operazioni anche su chi l'ha
if a_name and arena.players[a_name] then
block_league.sound_play("bl_kill", a_name)
arena_lib.sound_play(a_name, "bl_kill")
block_league.HUD_kill_update(a_name, S("YOU'VE CONTRIBUTED TO KILL @1", t_name))
if arena_lib.is_player_spectated(a_name) then
@ -553,7 +553,7 @@ end
function attack_loop(weapon, action, player, pointed_thing)
local p_name = player:get_player_name()
block_league.sound_play(action.sound, p_name)
arena_lib.sound_play(p_name, action.sound)
if action.type == "punch" then
attack_melee(player, weapon, action, pointed_thing)
@ -812,7 +812,7 @@ function weapon_reload(player, weapon)
or arena.players[p_name].weapons_magazine[w_name] == weapon.magazine
then return end
block_league.sound_play(weapon.sound_reload, p_name)
arena_lib.sound_play(p_name, weapon.sound_reload)
p_meta:set_int("bl_weapon_state", 4)