return beacon != null;
}
+ /// <summary>
+ /// Returns a string describing the rough distance and direction
+ /// to the position of <paramref name="ent"/> from the nearest beacon.
+ /// </summary>
[PublicAPI]
public string GetNearestBeaconString(Entity<TransformComponent?> ent)
{
return GetNearestBeaconString(_transformSystem.GetMapCoordinates(ent, ent.Comp));
}
+ /// <summary>
+ /// Returns a string describing the rough distance and direction
+ /// to <paramref name="coordinates"/> from the nearest beacon.
+ /// </summary>
+
public string GetNearestBeaconString(MapCoordinates coordinates)
{
if (!TryGetNearestBeacon(coordinates, out var beacon, out var pos))
// 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",