diff --git a/Content.Server/Pinpointer/NavMapSystem.cs b/Content.Server/Pinpointer/NavMapSystem.cs index 424b6427de..da9ab20a39 100644 --- a/Content.Server/Pinpointer/NavMapSystem.cs +++ b/Content.Server/Pinpointer/NavMapSystem.cs @@ -431,6 +431,10 @@ public sealed partial class NavMapSystem : SharedNavMapSystem return beacon != null; } + /// + /// Returns a string describing the rough distance and direction + /// to the position of from the nearest beacon. + /// [PublicAPI] public string GetNearestBeaconString(Entity ent) { @@ -440,6 +444,11 @@ public sealed partial class NavMapSystem : SharedNavMapSystem return GetNearestBeaconString(_transformSystem.GetMapCoordinates(ent, ent.Comp)); } + /// + /// Returns a string describing the rough distance and direction + /// to from the nearest beacon. + /// + public string GetNearestBeaconString(MapCoordinates coordinates) { if (!TryGetNearestBeacon(coordinates, out var beacon, out var pos)) @@ -451,10 +460,11 @@ public sealed partial class NavMapSystem : SharedNavMapSystem // get the angle between the two positions, adjusted for the grid rotation so that // we properly preserve north in relation to the grid. - var dir = (pos.Value.Position - coordinates.Position).ToWorldAngle(); + var offset = coordinates.Position - pos.Value.Position; + var dir = offset.ToWorldAngle(); var adjustedDir = (dir - gridOffset).GetDir(); - var length = (pos.Value.Position - coordinates.Position).Length(); + var length = offset.Length(); if (length < CloseDistance) { return Loc.GetString("nav-beacon-pos-format",