diff --git a/hud.lua b/hud.lua index f1f8975..c74a4dc 100644 --- a/hud.lua +++ b/hud.lua @@ -6,6 +6,7 @@ local hud_timer = 0 minetest.register_globalstep(function(dtime) + -- every 5 seconds hud_timer = hud_timer + dtime if hud_timer < 5 then return @@ -15,12 +16,12 @@ minetest.register_globalstep(function(dtime) for _, player in pairs(minetest.get_connected_players()) do local name = player:get_player_name() - local pos = vector.round(player:getpos()) + local pos = vector.round(player:get_pos()) local hud_text = "" local protectors = minetest.find_nodes_in_area( - {x=pos.x -radius , y=pos.y -radius , z=pos.z -radius}, - {x=pos.x +radius , y=pos.y +radius , z=pos.z +radius}, + {x = pos.x - radius , y = pos.y - radius , z = pos.z - radius}, + {x = pos.x + radius , y = pos.y + radius , z = pos.z + radius}, {"protector:protect","protector:protect2"}) if #protectors > 0 then @@ -58,4 +59,3 @@ end) minetest.register_on_leaveplayer(function(player) hud[player:get_player_name()] = nil end) -