Clean up ball notifications code (sound and HUD) (closes #114)
This commit is contained in:
parent
507737eede
commit
e61263c648
@ -27,6 +27,18 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function block_league.HUD_ball_update_team(arena, teamID, msg, hex_color)
|
||||||
|
arena_lib.HUD_send_msg_team("title", arena, teamID, msg, 3, nil, hex_color)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function block_league.HUD_ball_update_all(arena, msg, hex_color)
|
||||||
|
arena_lib.HUD_send_msg_all("title", arena, msg, 3, nil, hex_color)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function block_league.HUD_kill_update(p_name, msg)
|
function block_league.HUD_kill_update(p_name, msg)
|
||||||
local panel = panel_lib.get_panel(p_name, "bl_broadcast")
|
local panel = panel_lib.get_panel(p_name, "bl_broadcast")
|
||||||
|
|
||||||
|
@ -201,10 +201,7 @@ function ball:reset()
|
|||||||
|
|
||||||
-- annuncio
|
-- annuncio
|
||||||
arena_lib.sound_play_all(arena, "bl_voice_ball_reset")
|
arena_lib.sound_play_all(arena, "bl_voice_ball_reset")
|
||||||
|
block_league.HUD_ball_update_all(arena, S("Ball reset"))
|
||||||
for psp_name, _ in pairs(arena.players_and_spectators) do
|
|
||||||
block_league.HUD_ball_update(psp_name, S("Ball reset"))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- se è agganciata a qualcunə...
|
-- se è agganciata a qualcunə...
|
||||||
if self.p_name then
|
if self.p_name then
|
||||||
@ -231,20 +228,17 @@ function ball:announce_ball_possession_change(is_ball_lost)
|
|||||||
local arena = self.arena
|
local arena = self.arena
|
||||||
local teamID = self.team_id
|
local teamID = self.team_id
|
||||||
local enemy_teamID = teamID == 1 and 2 or 1
|
local enemy_teamID = teamID == 1 and 2 or 1
|
||||||
local team = arena_lib.get_players_in_team(arena, teamID)
|
|
||||||
local enemy_team = arena_lib.get_players_in_team(arena, enemy_teamID)
|
|
||||||
|
|
||||||
if is_ball_lost then
|
if is_ball_lost then
|
||||||
arena_lib.sound_play_team(arena, teamID, "bl_crowd_ohno")
|
arena_lib.sound_play_team(arena, teamID, "bl_crowd_ohno")
|
||||||
arena_lib.sound_play_team(arena, enemy_teamID, "bl_crowd_cheer")
|
arena_lib.sound_play_team(arena, enemy_teamID, "bl_crowd_cheer")
|
||||||
|
|
||||||
for _, pl_name in pairs(team) do
|
for sp_name, _ in pairs(arena_lib.get_target_spectators("block_league", arena.name, "entity", "Ball")) do
|
||||||
block_league.HUD_ball_update(pl_name, S("Your team has lost the ball!"), "0xff8e8e")
|
arena_lib.sound_play(sp_name, "bl_crowd_ohno")
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, pl_name in pairs(enemy_team) do
|
block_league.HUD_ball_update_team(arena, teamID, S("Your team has lost the ball!"), "0xff8e8e")
|
||||||
block_league.HUD_ball_update(pl_name, S("Enemy team has lost the ball!"), "0xabf877")
|
block_league.HUD_ball_update_team(arena, enemy_teamID, S("Enemy team has lost the ball!"), "0xabf877")
|
||||||
end
|
|
||||||
|
|
||||||
else
|
else
|
||||||
local p_name = self.p_name
|
local p_name = self.p_name
|
||||||
@ -253,14 +247,14 @@ function ball:announce_ball_possession_change(is_ball_lost)
|
|||||||
arena_lib.sound_play_team(arena, teamID, "bl_crowd_cheer")
|
arena_lib.sound_play_team(arena, teamID, "bl_crowd_cheer")
|
||||||
arena_lib.sound_play_team(arena, enemy_teamID, "bl_crowd_ohno")
|
arena_lib.sound_play_team(arena, enemy_teamID, "bl_crowd_ohno")
|
||||||
|
|
||||||
for _, pl_name in pairs(team) do
|
for sp_name, _ in pairs(arena_lib.get_target_spectators("block_league", arena.name, "entity", "Ball")) do
|
||||||
block_league.HUD_ball_update(pl_name, S("Your team has got the ball!"), "0xabf877")
|
arena_lib.sound_play(sp_name, "bl_crowd_cheer")
|
||||||
end
|
end
|
||||||
block_league.HUD_ball_update(p_name, S("You've got the ball!"), "0xabf877")
|
|
||||||
|
|
||||||
for _, pl_name in pairs(enemy_team) do
|
block_league.HUD_ball_update_team(arena, teamID, S("Your team has got the ball!"), "0xabf877")
|
||||||
block_league.HUD_ball_update(pl_name, S("Enemy team has got the ball!"), "0xff8e8e")
|
block_league.HUD_ball_update_team(arena, enemy_teamID, S("Enemy team has got the ball!"), "0xff8e8e")
|
||||||
end
|
|
||||||
|
block_league.HUD_ball_update(p_name, S("You've got the ball!"), "0xabf877")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -318,23 +312,20 @@ end
|
|||||||
|
|
||||||
function add_point(p_name, teamID, arena)
|
function add_point(p_name, teamID, arena)
|
||||||
local enemy_teamID = teamID == 1 and 2 or 1
|
local enemy_teamID = teamID == 1 and 2 or 1
|
||||||
local team = arena_lib.get_players_in_team(arena, teamID)
|
|
||||||
local enemy_team = arena_lib.get_players_in_team(arena, enemy_teamID)
|
|
||||||
|
|
||||||
for _, pl_name in pairs(team) do
|
arena_lib.sound_play_team(arena, teamID, "bl_crowd_cheer")
|
||||||
audio_lib.play_sfx("bl_crowd_cheer", {to_player = pl_name})
|
arena_lib.sound_play_team(arena, enemy_teamID, "bl_crowd_ohno")
|
||||||
block_league.HUD_ball_update(pl_name, S("NICE POINT!"), "0xabf877")
|
|
||||||
|
for sp_name, _ in pairs(arena_lib.get_target_spectators("block_league", arena.name, "entity", "Ball")) do
|
||||||
|
arena_lib.sound_play(sp_name, "bl_crowd_cheer")
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, pl_name in pairs(enemy_team) do
|
block_league.HUD_ball_update_team(arena, teamID, S("NICE POINT!"), "0xabf877")
|
||||||
audio_lib.play_sfx("bl_crowd_ohno", {to_player = pl_name})
|
block_league.HUD_ball_update_team(arena, enemy_teamID, S("ENEMY TEAM HAS SCORED..."), "0xff8e8e")
|
||||||
block_league.HUD_ball_update(pl_name, S("ENEMY TEAM HAS SCORED..."), "0xff8e8e")
|
|
||||||
end
|
|
||||||
|
|
||||||
local scoring_team_color = teamID == 1 and "0xf2a05b" or "0x55aef1"
|
local scoring_team_color = teamID == 1 and "0xf2a05b" or "0x55aef1"
|
||||||
|
|
||||||
for sp_name, _ in pairs(arena.spectators) do
|
for sp_name, _ in pairs(arena.spectators) do
|
||||||
audio_lib.play_sfx("bl_crowd_cheer", {to_player = sp_name})
|
|
||||||
block_league.HUD_ball_update(sp_name, "TOUCHDOWN!", scoring_team_color)
|
block_league.HUD_ball_update(sp_name, "TOUCHDOWN!", scoring_team_color)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,10 +37,12 @@ function display_and_start_countdown(arena, time_left)
|
|||||||
if time_left > 0 then
|
if time_left > 0 then
|
||||||
arena_lib.HUD_send_msg_all("broadcast", arena, time_left)
|
arena_lib.HUD_send_msg_all("broadcast", arena, time_left)
|
||||||
time_left = time_left -1
|
time_left = time_left -1
|
||||||
|
|
||||||
minetest.after(1, function()
|
minetest.after(1, function()
|
||||||
if arena.in_celebration then return end
|
if arena.in_celebration then return end
|
||||||
display_and_start_countdown(arena, time_left)
|
display_and_start_countdown(arena, time_left)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
else
|
else
|
||||||
arena_lib.HUD_hide("broadcast", arena)
|
arena_lib.HUD_hide("broadcast", arena)
|
||||||
round_start(arena)
|
round_start(arena)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user