From 1fb03e90740efc05e5d8537ccb3c469772b1f3fd Mon Sep 17 00:00:00 2001 From: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Date: Wed, 14 Aug 2024 06:38:36 -0700 Subject: [PATCH] Fix popups not working properly with an eye offset (#30990) --- Content.Client/Popups/PopupOverlay.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Content.Client/Popups/PopupOverlay.cs b/Content.Client/Popups/PopupOverlay.cs index 77eeb611f5..5a69457720 100644 --- a/Content.Client/Popups/PopupOverlay.cs +++ b/Content.Client/Popups/PopupOverlay.cs @@ -74,8 +74,14 @@ public sealed class PopupOverlay : Overlay return; var matrix = args.ViewportControl.GetWorldToScreenMatrix(); - var viewPos = new MapCoordinates(args.WorldAABB.Center, args.MapId); var ourEntity = _playerMgr.LocalEntity; + var viewPos = new MapCoordinates(args.WorldAABB.Center, args.MapId); + var ourPos = args.WorldBounds.Center; + if (ourEntity != null) + { + viewPos = _transform.GetMapCoordinates(ourEntity.Value); + ourPos = viewPos.Position; + } foreach (var popup in _popup.WorldLabels) { @@ -84,7 +90,7 @@ public sealed class PopupOverlay : Overlay if (mapPos.MapId != args.MapId) continue; - var distance = (mapPos.Position - args.WorldBounds.Center).Length(); + var distance = (mapPos.Position - ourPos).Length(); // Should handle fade here too wyci. if (!args.WorldBounds.Contains(mapPos.Position) || !_examine.InRangeUnOccluded(viewPos, mapPos, distance, -- 2.52.0