diff --git a/code/controllers/subsystems/responseteam.dm b/code/controllers/subsystems/responseteam.dm index 7429af498ac..fbce2f17151 100644 --- a/code/controllers/subsystems/responseteam.dm +++ b/code/controllers/subsystems/responseteam.dm @@ -87,11 +87,7 @@ SUBSYSTEM_DEF(distress) command_announcement.Announce("A distress beacon has been broadcasted to nearby vessels in the sector. Please remain calm and make preparations for the arrival of third parties.", "[SSatlas.current_map.station_name] Distress Suite", 'sound/ai/announcements/security_level_old.ogg', zlevels = requester.map_z) log_and_message_admins("has launched a distress beacon from the [requester.name] with message: [distress_message].", user) - var/datum/distress_beacon/beacon = new() - beacon.requester = requester - beacon.distress_message = distress_message - beacon.user = user - beacon.user_name = user.name //It is possible that the mob's name may change after the distress beacon is launched, so we keep this var to avoid stuff like that. + var/datum/distress_beacon/beacon = new(requester, distress_message, user) active_distress_beacons[requester.name] = beacon @@ -173,9 +169,15 @@ SUBSYSTEM_DEF(distress) /datum/distress_beacon var/distress_message var/obj/effect/overmap/visitable/requester - var/mob/living/carbon/human/user + var/datum/weakref/user var/user_name +/datum/distress_beacon/New(new_requester, new_message, mob/new_user) + requester = requester + distress_message = distress_message + user = WEAKREF(new_user) + user_name = new_user.name //It is possible that the mob's name may change after the distress beacon is launched, so we keep this var to avoid stuff like that. + /datum/distress_beacon/Destroy() requester = null user = null diff --git a/code/modules/overmap/ships/computers/sensors.dm b/code/modules/overmap/ships/computers/sensors.dm index e83b1542b6a..108bb04d223 100644 --- a/code/modules/overmap/ships/computers/sensors.dm +++ b/code/modules/overmap/ships/computers/sensors.dm @@ -149,12 +149,18 @@ for(var/requester in SSdistress.active_distress_beacons) var/datum/distress_beacon/beacon = SSdistress.active_distress_beacons[requester] var/obj/effect/overmap/vessel = beacon.requester - var/mob/living/carbon/human/H = beacon.user - var/job_string = H.job ? "[H.job] " : "" + var/mob/living/carbon/human/H = beacon.user.resolve() + + var/job_string = "N/A" + if(H) + job_string = H.job ? "[H.job] " : "" + var/bearing = round(90 - Atan2(vessel.x - linked.x, vessel.y - linked.y),5) if(bearing < 0) bearing += 360 - distress_beacons.Add(list(list("requester" = vessel.name, "sender" = "[job_string][H.name]", "bearing" = bearing))) + + distress_beacons.Add(list(list("requester" = vessel.name, "sender" = H ? "[job_string][beacon.user_name]" : "Unknown", "bearing" = bearing))) + if(length(distress_beacons)) data["distress_beacons"] = distress_beacons data["desired_range"] = sensors.desired_range @@ -379,7 +385,10 @@ if (action == "play_message") var/requester = params["play_message"] var/datum/distress_beacon/beacon = SSdistress.active_distress_beacons[requester] - var/mob/living/carbon/human/sender = beacon.user + var/mob/living/carbon/human/sender = beacon.user.resolve() + if(!sender) + visible_message(SPAN_NOTICE("\The [src] beeps unsuccessfully, signalling an error in the playback.")) + return TRUE var/user_name = beacon.user_name var/accent_icon = sender.get_accent_icon() visible_message(SPAN_NOTICE("\The [src] beeps a few times as it replays the distress message.")) diff --git a/html/changelogs/mattatlas-fixdistress.yml b/html/changelogs/mattatlas-fixdistress.yml new file mode 100644 index 00000000000..933ce71d92a --- /dev/null +++ b/html/changelogs/mattatlas-fixdistress.yml @@ -0,0 +1,58 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Distress beacons no longer make all sensors consoles stop functioning."