From aa575ae02bfe7246aac90ec19c12ceccc8537c40 Mon Sep 17 00:00:00 2001 From: whosit Date: Mon, 8 May 2023 00:22:50 +0300 Subject: [PATCH] hack to fix overlapping label/distance of waypoint display --- waypoint_lib.lua | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/waypoint_lib.lua b/waypoint_lib.lua index 8e3b547..28d0454 100644 --- a/waypoint_lib.lua +++ b/waypoint_lib.lua @@ -79,21 +79,31 @@ end local IconWaypointHUD = {} function IconWaypointHUD:new(point_pos, label, label_color, icon, icon_scale, icon_color) local w = { + hud_id_distance = nil, hud_id_label = nil, hud_id_icon = nil, } self.__index = self setmetatable(w, self) - - w.huddef_label = { + + w.huddef_distance = { hud_elem_type = "waypoint", - name = label, text = "m", -- distance suffix precision = WAYPOINT_PRECISION, -- TODO make this configurable? number = label_color, world_pos = point_pos, offset = {x=0,y=0}, - alignment = {x=0, y=1}, -- move down + alignment = {x=0, y=0.5}, -- move down + } + + w.huddef_label = { + hud_elem_type = "waypoint", + name = label, + precision = 0, -- value of 0 disables the distance display + number = label_color, + world_pos = point_pos, + offset = {x=0,y=0}, + alignment = {x=0, y=4}, -- move futher down } w.huddef_icon = { @@ -114,12 +124,14 @@ end function IconWaypointHUD:show(player) --self.player_name = player:get_player_name() + self.hud_id_distance = player:hud_add(self.huddef_distance) self.hud_id_label = player:hud_add(self.huddef_label) self.hud_id_icon = player:hud_add(self.huddef_icon) end function IconWaypointHUD:hide(player) + player:hud_remove(self.hud_id_distance) player:hud_remove(self.hud_id_label) player:hud_remove(self.hud_id_icon) end