diff --git a/minigame_manager.lua b/minigame_manager.lua index 310b019..0725f3a 100644 --- a/minigame_manager.lua +++ b/minigame_manager.lua @@ -25,6 +25,21 @@ local function sumo_remove_controls_hud(p_name) -- huds[p_name].controls = nil end +local function sumo_set_attribute_lives(arena, pl_name) + local player = minetest.get_player_by_name(pl_name) + if player then + local lives = arena.players[pl_name].lives + local tag = " " + for i=1,lives do + tag = tag .. "♡ " + end + player:set_nametag_attributes({ + text = tag, + color = {a=255, r=255, g=255, b=255} + }) + end +end + local function send_message(arena,num_str) arena_lib.HUD_send_msg_all("title", arena, num_str, 1,nil,0xE6482E) @@ -38,7 +53,10 @@ arena_lib.on_load("sumo", function(arena) ---minetest.log('First: '..dump(pl_name).. " is "..type(pl_name)) local player = minetest.get_player_by_name(pl_name) sumo.invincible[pl_name] = true - sumo_show_controls_hud(pl_name) + sumo_show_controls_hud(pl_name) + sumo_set_attribute_lives(arena, pl_name) + + arena.players[pl_name].lives = arena.lives local player = minetest.get_player_by_name(pl_name) @@ -150,7 +168,7 @@ arena_lib.on_time_tick('sumo', function(arena) if arena.players[pl_name].running == true then message = T("Running...").." ".. message end - message = message.." "..T("Lives:").." " ..arena.players[pl_name].lives + message = message.." ".."♡ x ".." " ..arena.players[pl_name].lives if sumo.invincible[pl_name] == true then message = T("Invincible") c = 0xE6482E @@ -194,6 +212,7 @@ function sumo.kill_player(arena,pl_name) local player = minetest.get_player_by_name(pl_name) local sp_pos = arena_lib.get_random_spawner(arena) if player then + sumo_set_attribute_lives(arena, pl_name) player:move_to(sp_pos, false) player:get_inventory():set_stack("main", 1, ItemStack("sumo:pushstick")) minetest.after(3,function(pl_name) @@ -249,7 +268,6 @@ end, true) arena_lib.on_timeout('sumo', function(arena) local winner_names = {} for p_name, p_stats in pairs(arena.players) do - local player = minetest.get_player_by_name(pl_name) sumo_remove_controls_hud(p_name) table.insert(winner_names, p_name) end @@ -279,6 +297,7 @@ arena_lib.on_death('sumo', function(arena, p_name, reason) gain = 2.0, }) if player then + sumo_set_attribute_lives(arena, p_name) player:move_to(sp_pos, false) end