From de3fb72973ea35bfb6a7b1964a32e62d821daeb8 Mon Sep 17 00:00:00 2001 From: san7890 Date: Mon, 10 Jul 2023 11:19:32 -0600 Subject: [PATCH] Adds Radio Circuit Component Signaler to list-signalers (#76613) ## About The Pull Request Fixes #76503 Probably important for this stuff to be logged. ## Why It's Good For The Game Helps admins figure out the signallers that are signalling, and who triggered the signaller. ## Changelog :cl: admin: If a circuit component outputs a radio signal, it should now be logged in list-signalers. /:cl: --- .../wiremod/components/action/radio.dm | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/code/modules/wiremod/components/action/radio.dm b/code/modules/wiremod/components/action/radio.dm index e45b72c7f0c..cd13e0e1e45 100644 --- a/code/modules/wiremod/components/action/radio.dm +++ b/code/modules/wiremod/components/action/radio.dm @@ -22,8 +22,23 @@ /// Current frequency value var/current_freq = DEFAULT_SIGNALER_CODE + /// Holds a reference to the shell. + var/atom/movable/parent_shell = null + + /// The ckey of the user who used the shell we were placed in, important for signalling logs. + var/owner_ckey = null + var/datum/radio_frequency/radio_connection +/obj/item/circuit_component/radio/register_shell(atom/movable/shell) + parent_shell = shell + var/potential_fingerprints = shell.fingerprintslast + if(!isnull(potential_fingerprints)) + owner_ckey = potential_fingerprints + +/obj/item/circuit_component/radio/unregister_shell(atom/movable/shell) + parent_shell = null + /obj/item/circuit_component/radio/populate_options() var/static/component_options = list( COMP_RADIO_PUBLIC, @@ -58,7 +73,20 @@ current_freq = frequency if(COMPONENT_TRIGGERED_BY(trigger_input, port)) - var/datum/signal/signal = new(list("code" = round(code.value) || 0, "key" = parent?.owner_id)) + var/signal_code = round(code.value) || 0 + var/turf/location = get_turf(src) + var/time = time2text(world.realtime,"hh:mm:ss") + + var/list/loggable_strings = list("[time] : The [QDELETED(parent_shell) ? "null circuit shell(?)" : parent_shell] @ location ([location.x],[location.y],[location.z]) transmitted the following signal : [format_frequency(current_freq)]/[signal_code] via the radio circuit component.") + if(!isnull(owner_ckey)) + loggable_strings += ": The person who inserted the signalling circuit component was very likely [owner_ckey]." + if(!QDELETED(parent_shell)) + loggable_strings += ": The last fingerprints on the containing shell was [parent_shell.fingerprintslast]." + + var/loggable_string = loggable_strings.Join(" ") + GLOB.lastsignalers.Add(loggable_string) + + var/datum/signal/signal = new(list("code" = signal_code, "key" = parent?.owner_id), logging_data = loggable_string) radio_connection.post_signal(src, signal) /obj/item/circuit_component/radio/receive_signal(datum/signal/signal)