Show the lives of players on their head

This commit is contained in:
MrFreeman 2022-10-21 19:39:54 +02:00
parent 9f805b70de
commit 3ac39b665c

View File

@ -48,6 +48,18 @@ arena_lib.on_load("sumo", function(arena)
})
local player = minetest.get_player_by_name(pl_name)
if player then
player:set_nametag_attributes({
text = T("Lives:").. " " ..arena.players[pl_name].lives,
color = {a=255, r=255, g=255, b=255}
})
end
arena.players[pl_name].lives = arena.lives
local player = minetest.get_player_by_name(pl_name)
local pos = player:get_pos()
@ -204,6 +216,10 @@ 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
player:set_nametag_attributes({
text = T("Lives:").. " " ..arena.players[pl_name].lives,
color = {a=255, r=255, g=255, b=255}
})
player:move_to(sp_pos, false)
player:get_inventory():set_stack("main", 1, ItemStack("sumo:pushstick"))
minetest.after(3,function(pl_name)
@ -291,6 +307,10 @@ arena_lib.on_death('sumo', function(arena, p_name, reason)
gain = 2.0,
})
if player then
player:set_nametag_attributes({
text = T("Lives:").. " " ..arena.players[p_name].lives,
color = {a=255, r=255, g=255, b=255}
})
player:move_to(sp_pos, false)
end