From 22e7a14dfb4a66c318cafe9047592880881fc8c0 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:14:04 +0100 Subject: [PATCH] [MIRROR] [NO GBP] Fixes tcomms relays being permanent (attempt 2) [MDB IGNORE] (#24963) * [NO GBP] Fixes tcomms relays being permanent (attempt 2) (#79558) ## About The Pull Request The problem was that the levels var of signals was being used as both a list for the levels the receivers can receive on and the levels broadcasters can broadcast on. So basically I caused this problem in #74788 because I removed receivers clearing the levels list after receiving the signal. This solved the problem of one receiver clearing the receiving list, preventing any other receivers from receiving the message. However, this led to the receiving levels sticking around to the point when the list was meant to be used for broadcasting levels. I originally tried to solve this problem in #78812 but this fix is much simpler. Another solution could be to make it so that there's separate vars for receiving levels and broadcasting levels instead of using the same var. idk if thats better or not though ## Why It's Good For The Game Fixes #78806 ## Changelog :cl: fix: Fixed tcomms relays being weird, they should be sabotagable again /:cl: * [NO GBP] Fixes tcomms relays being permanent (attempt 2) --------- Co-authored-by: BlueMemesauce <47338680+BlueMemesauce@users.noreply.github.com> --- code/game/machinery/telecomms/machines/receiver.dm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/telecomms/machines/receiver.dm b/code/game/machinery/telecomms/machines/receiver.dm index 0c4b6d2a02d..def8384b139 100644 --- a/code/game/machinery/telecomms/machines/receiver.dm +++ b/code/game/machinery/telecomms/machines/receiver.dm @@ -20,9 +20,15 @@ if(!is_freq_listening(signal)) return - // send the signal to the hub if possible, or a bus otherwise - if(!relay_information(signal, /obj/machinery/telecomms/hub)) - relay_information(signal, /obj/machinery/telecomms/bus) + // Make a copy of the signal so that other recievers can still recieve this signal + var/datum/signal/subspace/signal_copy = signal.copy() + + // Signal has been recieved, so remove receiving levels. This list will be used later on to determine broadcasting levels. + signal_copy.levels = list() + + // Send the signal to a hub if possible, or a bus otherwise. + if(!relay_information(signal_copy, /obj/machinery/telecomms/hub)) + relay_information(signal_copy, /obj/machinery/telecomms/bus) use_power(idle_power_usage)