makes radios use paths instead of new (#70252)

* makes radios initialize in Initialize instead of init()
This commit is contained in:
Fikou
2022-10-03 09:46:02 +02:00
committed by GitHub
parent deff8d5d6f
commit 9dddcb6f48
6 changed files with 59 additions and 148 deletions
@@ -57,6 +57,8 @@ GLOBAL_LIST_INIT(channel_tokens, list(
/obj/item/radio/headset/Initialize(mapload)
. = ..()
if(ispath(keyslot2))
keyslot2 = new keyslot2()
set_listening(TRUE)
recalculateChannels()
possibly_deactivate_in_loc()
@@ -72,7 +74,8 @@ GLOBAL_LIST_INIT(channel_tokens, list(
possibly_deactivate_in_loc()
/obj/item/radio/headset/Destroy()
QDEL_NULL(keyslot2)
if(istype(keyslot2))
QDEL_NULL(keyslot2)
return ..()
/obj/item/radio/headset/ui_data(mob/user)
@@ -123,18 +126,13 @@ GLOBAL_LIST_INIT(channel_tokens, list(
command = TRUE
/obj/item/radio/headset/binary
/obj/item/radio/headset/binary/Initialize(mapload)
. = ..()
qdel(keyslot)
keyslot = new /obj/item/encryptionkey/binary
recalculateChannels()
keyslot = /obj/item/encryptionkey/binary
/obj/item/radio/headset/headset_sec
name = "security radio headset"
desc = "This is used by your elite security force."
icon_state = "sec_headset"
keyslot = new /obj/item/encryptionkey/headset_sec
keyslot = /obj/item/encryptionkey/headset_sec
/obj/item/radio/headset/headset_sec/alt
name = "security bowman headset"
@@ -150,49 +148,49 @@ GLOBAL_LIST_INIT(channel_tokens, list(
name = "engineering radio headset"
desc = "When the engineers wish to chat like girls."
icon_state = "eng_headset"
keyslot = new /obj/item/encryptionkey/headset_eng
keyslot = /obj/item/encryptionkey/headset_eng
/obj/item/radio/headset/headset_rob
name = "robotics radio headset"
desc = "Made specifically for the roboticists, who cannot decide between departments."
icon_state = "rob_headset"
keyslot = new /obj/item/encryptionkey/headset_rob
keyslot = /obj/item/encryptionkey/headset_rob
/obj/item/radio/headset/headset_med
name = "medical radio headset"
desc = "A headset for the trained staff of the medbay."
icon_state = "med_headset"
keyslot = new /obj/item/encryptionkey/headset_med
keyslot = /obj/item/encryptionkey/headset_med
/obj/item/radio/headset/headset_sci
name = "science radio headset"
desc = "A sciency headset. Like usual."
icon_state = "sci_headset"
keyslot = new /obj/item/encryptionkey/headset_sci
keyslot = /obj/item/encryptionkey/headset_sci
/obj/item/radio/headset/headset_medsci
name = "medical research radio headset"
desc = "A headset that is a result of the mating between medical and science."
icon_state = "medsci_headset"
keyslot = new /obj/item/encryptionkey/headset_medsci
keyslot = /obj/item/encryptionkey/headset_medsci
/obj/item/radio/headset/headset_srvsec
name = "law and order headset"
desc = "In the criminal justice headset, the encryption key represents two separate but equally important groups. Sec, who investigate crime, and Service, who provide services. These are their comms."
icon_state = "srvsec_headset"
keyslot = new /obj/item/encryptionkey/headset_srvsec
keyslot = /obj/item/encryptionkey/headset_srvsec
/obj/item/radio/headset/headset_srvmed
name = "psychology headset"
desc = "A headset allowing the wearer to communicate with medbay and service."
icon_state = "med_headset"
keyslot = new /obj/item/encryptionkey/headset_srvmed
keyslot = /obj/item/encryptionkey/headset_srvmed
/obj/item/radio/headset/headset_com
name = "command radio headset"
desc = "A headset with a commanding channel."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/headset_com
keyslot = /obj/item/encryptionkey/headset_com
/obj/item/radio/headset/heads
command = TRUE
@@ -201,7 +199,7 @@ GLOBAL_LIST_INIT(channel_tokens, list(
name = "\proper the captain's headset"
desc = "The headset of the king."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/heads/captain
keyslot = /obj/item/encryptionkey/heads/captain
/obj/item/radio/headset/heads/captain/alt
name = "\proper the captain's bowman headset"
@@ -217,13 +215,13 @@ GLOBAL_LIST_INIT(channel_tokens, list(
name = "\proper the research director's headset"
desc = "Headset of the fellow who keeps society marching towards technological singularity."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/heads/rd
keyslot = /obj/item/encryptionkey/heads/rd
/obj/item/radio/headset/heads/hos
name = "\proper the head of security's headset"
desc = "The headset of the man in charge of keeping order and protecting the station."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/heads/hos
keyslot = /obj/item/encryptionkey/heads/hos
/obj/item/radio/headset/heads/hos/alt
name = "\proper the head of security's bowman headset"
@@ -239,57 +237,57 @@ GLOBAL_LIST_INIT(channel_tokens, list(
name = "\proper the chief engineer's headset"
desc = "The headset of the guy in charge of keeping the station powered and undamaged."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/heads/ce
keyslot = /obj/item/encryptionkey/heads/ce
/obj/item/radio/headset/heads/cmo
name = "\proper the chief medical officer's headset"
desc = "The headset of the highly trained medical chief."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/heads/cmo
keyslot = /obj/item/encryptionkey/heads/cmo
/obj/item/radio/headset/heads/hop
name = "\proper the head of personnel's headset"
desc = "The headset of the guy who will one day be captain."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/heads/hop
keyslot = /obj/item/encryptionkey/heads/hop
/obj/item/radio/headset/heads/qm
name = "\proper the quartermaster's headset"
desc = "The headset of the guy who runs the cargo department."
icon_state = "com_headset"
keyslot = new /obj/item/encryptionkey/heads/qm
keyslot = /obj/item/encryptionkey/heads/qm
/obj/item/radio/headset/headset_cargo
name = "supply radio headset"
desc = "A headset used by the QM's slaves."
icon_state = "cargo_headset"
keyslot = new /obj/item/encryptionkey/headset_cargo
keyslot = /obj/item/encryptionkey/headset_cargo
/obj/item/radio/headset/headset_cargo/mining
name = "mining radio headset"
desc = "Headset used by shaft miners."
icon_state = "mine_headset"
keyslot = new /obj/item/encryptionkey/headset_mining
keyslot = /obj/item/encryptionkey/headset_mining
/obj/item/radio/headset/headset_srv
name = "service radio headset"
desc = "Headset used by the service staff, tasked with keeping the station full, happy and clean."
icon_state = "srv_headset"
keyslot = new /obj/item/encryptionkey/headset_service
keyslot = /obj/item/encryptionkey/headset_service
/obj/item/radio/headset/headset_cent
name = "\improper CentCom headset"
desc = "A headset used by the upper echelons of Nanotrasen."
icon_state = "cent_headset"
keyslot = new /obj/item/encryptionkey/headset_com
keyslot2 = new /obj/item/encryptionkey/headset_cent
keyslot = /obj/item/encryptionkey/headset_cent
keyslot2 = /obj/item/encryptionkey/headset_com
/obj/item/radio/headset/headset_cent/empty
keyslot = null
keyslot2 = null
/obj/item/radio/headset/headset_cent/commander
keyslot = new /obj/item/encryptionkey/heads/captain
keyslot2 = /obj/item/encryptionkey/heads/captain
/obj/item/radio/headset/headset_cent/alt
name = "\improper CentCom bowman headset"
@@ -81,6 +81,8 @@
secure_radio_connections = list()
. = ..()
if(ispath(keyslot))
keyslot = new keyslot()
for(var/ch_name in channels)
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
@@ -94,7 +96,8 @@
/obj/item/radio/Destroy()
remove_radio_all(src) //Just to be sure
QDEL_NULL(wires)
QDEL_NULL(keyslot)
if(istype(keyslot))
QDEL_NULL(keyslot)
return ..()
/obj/item/radio/proc/set_frequency(new_frequency)
@@ -141,7 +144,7 @@
/obj/item/radio/proc/make_syndie() // Turns normal radios into Syndicate radios!
qdel(keyslot)
keyslot = new /obj/item/encryptionkey/syndicate
keyslot = new /obj/item/encryptionkey/syndicate()
syndie = TRUE
recalculateChannels()
@@ -469,12 +472,6 @@
user.visible_message(span_suicide("[user] starts bouncing [src] off [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!"))
return BRUTELOSS
/obj/item/radio/Destroy()
remove_radio_all(src) //Just to be sure
QDEL_NULL(wires)
QDEL_NULL(keyslot)
return ..()
/obj/item/radio/proc/end_emp_effect(curremp)
if(emped != curremp) //Don't fix it if it's been EMP'd again
return FALSE
@@ -503,7 +500,7 @@
/obj/item/radio/borg/syndicate
syndie = TRUE
keyslot = new /obj/item/encryptionkey/syndicate
keyslot = /obj/item/encryptionkey/syndicate
/obj/item/radio/borg/syndicate/Initialize(mapload)
. = ..()