From 0e4966b6e0ffbc95b0d6e8ced982ad26d276d2f4 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:32:37 +0200 Subject: [PATCH] [MIRROR] Fixes a bug that made it so radios inside objects would blare out their comms to everyone around them (#29293) * Fixes a bug that made it so radios inside objects would blare out their comms to everyone around them (#85676) ## About The Pull Request Currently things like bounty cubes that are not supposed to be broadcasting comms, are doing so for the department their nested radio is set to. This happens because when an encryption key is put into a radio that is off and that radio has its channels recalculated, all of the default channels on the encryption key (in the case of bounty cubes, supply) are set to being on and the radio 'forgets' that its supposed to be off until it is turned back on, then turned off again. Obviously we cannot do this to a radio inside of an object in game, as we have no way of accessing it, so I am adding a check for if the radio is off at the end of recalculatechannels() and if it is off, it will turn it on, then back off so it can remember ## Why It's Good For The Game fixes a rather minor bug which gives anyone free [insert comms channel here] for any object with a radio inside that is given an encryption key, my example being a bounty cube with a radio and an encryption key for cargo. This could also be solved by going through every single instance of a nested radio and taking away their keys and instead doing set_frequency(FREQ_) However, this would nip the bug in the bud when otherwise the way its been being written should be working. ## Changelog :cl: fix: fixed nested radios with encryption keys giving free comms /:cl: --------- Co-authored-by: Odairu <39929315+Odairu@ users.noreply.github.com> * Fixes a bug that made it so radios inside objects would blare out their comms to everyone around them --------- Co-authored-by: Odairu Co-authored-by: Odairu <39929315+Odairu@ users.noreply.github.com> --- code/game/objects/items/devices/radio/radio.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 3d61f2a1760..a068477a059 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -159,6 +159,9 @@ for(var/channel_name in channels) secure_radio_connections[channel_name] = add_radio(src, GLOB.radiochannels[channel_name]) + if(!listening) + remove_radio_all(src) + // Used for cyborg override /obj/item/radio/proc/resetChannels() channels = list()