getEntityMercatorLocation

open fun getEntityMercatorLocation(entityId: Int): MercatorZone

Returns the Mercator location of the entity with the given id, resolved via the engine's point/polygon/polyline tables.

Use this instead of getLocation for any distance calculation. EntityZone.getLocation() returns a MercatorZone with x=0, y=0 because LIME's EntityZone struct doesn't carry the location — surfacing as the "11,065 km" search-distance bug when distance was computed from a valid user position to a zero-coord entity zone.

Resolution order:

  1. If the engine Entity has pointId > 0: use the point's (x, y).
  2. Else if polygonId > 0: use the polygon centroid.
  3. Else if polylineId > 0: use the polyline's first vertex.
  4. Otherwise return null — caller decides to skip the distance calc.