GPSes now show the general direction of crosslinked z-levels (#87437)

## About The Pull Request

This makes the GPS UI give the general direction of a GPS on a different
linked z-level.


https://github.com/user-attachments/assets/98c6dfd8-5ced-4145-b14a-3813821ef30c


## Why It's Good For The Game

Makes navigating through space less of a chore, as previously, I believe
the only way was to manually write down or memorize what direction was
linked to what z-level.

## Changelog
🆑
add: GPSes now show the general direction of cross-linked z-levels.
/🆑
This commit is contained in:
Lucy
2024-10-26 15:41:34 +02:00
committed by GitHub
parent ec9dfd5980
commit 57cc38c789
4 changed files with 50 additions and 9 deletions
+11 -7
View File
@@ -137,19 +137,23 @@ GLOBAL_LIST_EMPTY(GPS_list)
var/list/signals = list()
data["signals"] = list()
for(var/gps in GLOB.GPS_list)
var/datum/component/gps/G = gps
if(G.emped || !G.tracking || G == src)
for(var/datum/component/gps/gps as anything in GLOB.GPS_list)
if(gps == src || gps.emped || !gps.tracking)
continue
var/turf/pos = get_turf(G.parent)
if(!pos || !global_mode && pos.z != curr.z)
var/turf/pos = get_turf(gps.parent)
if(!pos || (!global_mode && pos.z != curr.z))
continue
var/list/signal = list()
signal["entrytag"] = G.gpstag //Name or 'tag' of the GPS
signal["entrytag"] = gps.gpstag //Name or 'tag' of the GPS
signal["coords"] = "[pos.x], [pos.y], [pos.z]"
if(pos.z == curr.z) //Distance/Direction calculations for same z-level only
// Distance is calculated for the same z-level only, and direction is calculated for crosslinked/neighboring and same z-levels.
if(pos.z == curr.z)
signal["dist"] = max(get_dist(curr, pos), 0) //Distance between the src and remote GPS turfs
signal["degrees"] = round(get_angle(curr, pos)) //0-360 degree directional bearing, for more precision.
else
var/angle = get_linked_z_angle(curr.z, pos.z)
if(!isnull(angle))
signal["degrees"] = angle
signals += list(signal) //Add this signal to the list of signals
data["signals"] = signals
return data