diff --git a/bl_HUD/hud_inputs.lua b/bl_HUD/hud_inputs.lua index 83d6d46..69dfed4 100644 --- a/bl_HUD/hud_inputs.lua +++ b/bl_HUD/hud_inputs.lua @@ -2,25 +2,29 @@ local saved_huds = {} -- p_name = {indexes} -function block_league.HUD_show_inputs(p_name) +function block_league.HUD_show_inputs(arena) - local HUD = { - hud_elem_type = "image", - position = {x = 0.5, y = 0.5}, - text = "bl_hud_keyboard.png", - scale = { x = 4, y = 4}, - number = "0xFFFFFF" - } + for pl_name, _ in pairs(arena.players) do - local player = minetest.get_player_by_name(p_name) - local HUD_ID = player:hud_add(HUD) + local HUD = { + hud_elem_type = "image", + position = {x = 0.5, y = 0.5}, + text = "bl_hud_keyboard.png", + scale = { x = 4, y = 4}, + number = "0xFFFFFF" + } + local player = minetest.get_player_by_name(pl_name) + local HUD_ID = player:hud_add(HUD) - saved_huds[p_name] = HUD_ID + saved_huds[pl_name] = HUD_ID + end end -function block_league.HUD_remove_inputs(p_name) - minetest.get_player_by_name(p_name):hud_remove(saved_huds[p_name]) - saved_huds[p_name] = nil +function block_league.HUD_remove_inputs(arena) + for pl_name, _ in pairs(arena.players) do + minetest.get_player_by_name(pl_name):hud_remove(saved_huds[pl_name]) + saved_huds[pl_name] = nil + end end diff --git a/bl_arena_lib/arena_manager.lua b/bl_arena_lib/arena_manager.lua index 2133813..cd3fdca 100644 --- a/bl_arena_lib/arena_manager.lua +++ b/bl_arena_lib/arena_manager.lua @@ -13,8 +13,6 @@ arena_lib.on_load("block_league", function(arena) reset_meta(pl_name) equip_weapons(arena, pl_name) create_and_show_HUD(arena, pl_name) - block_league.HUD_show_inputs(pl_name) - arena_lib.HUD_send_msg("broadcast", pl_name, S("The game will start soon")) block_league.refill_weapons(arena, pl_name) end @@ -22,17 +20,16 @@ arena_lib.on_load("block_league", function(arena) block_league.info_panel_update(arena) end) + block_league.HUD_show_inputs(arena) + arena_lib.HUD_send_msg_all("broadcast", arena, S("The game will start soon")) + block_league.countdown_and_start(arena, 3) end) arena_lib.on_start("block_league", function(arena) - - for pl_name, _ in pairs(arena.players) do - block_league.HUD_remove_inputs(pl_name) - end - + block_league.HUD_remove_inputs(arena) block_league.energy_refill_loop(arena) end)