From: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:38:36 +0000 (-0700) Subject: Fix popups not working properly with an eye offset (#30990) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=1fb03e90740efc05e5d8537ccb3c469772b1f3fd;p=space-station-14.git Fix popups not working properly with an eye offset (#30990) --- 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,