hack to fix overlapping label/distance of waypoint display

This commit is contained in:
whosit 2023-05-08 00:22:50 +03:00
parent ffd618cee0
commit aa575ae02b
1 changed files with 16 additions and 4 deletions

View File

@ -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