Skip to content

Commit

Permalink
Adds Radio Circuit Component Signaler to list-signalers (#76613)
Browse files Browse the repository at this point in the history
## 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:
  • Loading branch information
san7890 authored and Absolucy committed Nov 29, 2024
1 parent f133a31 commit 1dec06f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion code/modules/wiremod/components/action/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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] <B>:</B> The [QDELETED(parent_shell) ? "null circuit shell(?)" : parent_shell] @ location ([location.x],[location.y],[location.z]) transmitted the following signal <B>:</B> [format_frequency(current_freq)]/[signal_code] via the radio circuit component.")
if(!isnull(owner_ckey))
loggable_strings += "<B>:</B> The person who inserted the signalling circuit component was very likely [owner_ckey]."
if(!QDELETED(parent_shell))
loggable_strings += "<B>:</B> 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)
Expand Down

0 comments on commit 1dec06f

Please sign in to comment.