Fixes bug with headsets unsetting channels after moving them (#64763)

Readds them to the global radio channels they belong to as opposed to setting what they belong to on equipped.
This commit is contained in:
Kylerace
2022-02-08 23:44:24 -08:00
committed by GitHub
parent be1471a6de
commit ea50ace23a
+13 -7
View File
@@ -110,9 +110,9 @@
resetChannels()
if(keyslot)
for(var/ch_name in keyslot.channels)
if(!(ch_name in channels))
channels[ch_name] = keyslot.channels[ch_name]
for(var/channel_name in keyslot.channels)
if(!(channel_name in channels))
channels[channel_name] = keyslot.channels[channel_name]
if(keyslot.translate_binary)
translate_binary = TRUE
@@ -121,8 +121,8 @@
if(keyslot.independent)
independent = TRUE
for(var/ch_name in channels)
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
for(var/channel_name in channels)
secure_radio_connections[channel_name] = add_radio(src, GLOB.radiochannels[channel_name])
// Used for cyborg override
/obj/item/radio/proc/resetChannels()
@@ -132,6 +132,13 @@
syndie = FALSE
independent = FALSE
///goes through all radio channels we should be listening for and readds them to the global list
/obj/item/radio/proc/readd_listening_radio_channels()
for(var/channel_name in channels)
add_radio(src, GLOB.radiochannels[channel_name])
add_radio(src, FREQ_COMMON)
/obj/item/radio/proc/make_syndie() // Turns normal radios into Syndicate radios!
qdel(keyslot)
keyslot = new /obj/item/encryptionkey/syndicate
@@ -179,8 +186,7 @@
should_be_listening = listening
if(listening && on)
recalculateChannels()
add_radio(src, frequency)
readd_listening_radio_channels()
else if(!listening)
remove_radio_all(src)