diff --git a/Scripts/global/nameplate.lua b/Scripts/global/nameplate.lua index 3ddde3b4..717b3cfa 100644 --- a/Scripts/global/nameplate.lua +++ b/Scripts/global/nameplate.lua @@ -166,7 +166,8 @@ function Nameplate:draw(x, y, fade) if self.now and self.shiny then self:draw_sparkles(x, y, fade) end local dan_offset = 0 - if self.dan ~= -1 then + -- a plate without a player badge (the entry screen) shows no dan + if self.dan ~= -1 and self.pnum_tex then tex.draw_texture(self.dan_emblem_bg, { x = x, y = y, fade = fade }) if self.is_gold then tex.draw_texture(self.dan_emblem_gold, { frame = self.dan, x = x, y = y, fade = fade }) @@ -187,9 +188,13 @@ function Nameplate:draw(x, y, fade) local frame_top_h = self.frame_top_info.height local outline_h = self.outline_info.height - local name_max = frame_top_w - self.padding - offset - dan_offset + -- the name is centred right of the badge, or right of the dan chip (drawn at its texture.json x, + -- so where it ends doesn't depend on the badge) + local left = offset + if dan_offset > 0 then left = math.max(offset, self.emblem_info.x[1] + dan_offset) end + local name_max = frame_top_w - self.padding - left local name_width = math.min(self.name_text.width, name_max) - local name_x = x + offset + dan_offset + (outline_w - offset - dan_offset) / 2.0 - name_width / 2 + local name_x = x + left + (outline_w - left) / 2.0 - name_width / 2 local name_y = y + outline_h / 2.0 + self.name_offset self.name_text:draw({ x = name_x, y = name_y, x2 = name_width - self.name_text.width, fade = fade })