Fixes distress beacons breaking all sensors consoles. (#22864)

These things are ultra shitcode and need to be remade from the ground
up, but for the time being this stops them from exploding the server.

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2026-07-18 00:13:08 +00:00
committed by GitHub
co-authored by Matt Atlas
parent a0c5ab0a09
commit 126c188758
3 changed files with 79 additions and 10 deletions
+8 -6
View File
@@ -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
@@ -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."))
+58
View File
@@ -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."