diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
index cc3ffdeadf3..3c19bf75ebb 100755
--- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
@@ -26,18 +26,18 @@ Filter types:
ex_node_offset = 5
-obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency)
+/obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
-obj/machinery/atmospherics/trinary/filter/New()
- if(radio_controller)
+/obj/machinery/atmospherics/trinary/filter/New()
+ if(ticker && ticker.current_state == GAME_STATE_PLAYING)
initialize()
..()
-obj/machinery/atmospherics/trinary/filter/update_icon()
+/obj/machinery/atmospherics/trinary/filter/update_icon()
if(stat & NOPOWER)
icon_state = "hintact_off"
else if(node2 && node3 && node1)
@@ -47,14 +47,14 @@ obj/machinery/atmospherics/trinary/filter/update_icon()
on = 0
..()
-obj/machinery/atmospherics/trinary/filter/power_change()
+/obj/machinery/atmospherics/trinary/filter/power_change()
var/old_stat = stat
..()
if(old_stat != stat)
on = !on
update_icon()
-obj/machinery/atmospherics/trinary/filter/process()
+/obj/machinery/atmospherics/trinary/filter/process()
. = ..()
if(!on)
return
@@ -109,12 +109,14 @@ obj/machinery/atmospherics/trinary/filter/process()
return 1
-obj/machinery/atmospherics/trinary/filter/initialize()
+/obj/machinery/atmospherics/trinary/filter/initialize()
+ if (!radio_controller)
+ return
set_frequency(frequency)
..()
-obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
+/obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
if(..())
return
@@ -167,7 +169,7 @@ obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
onclose(user, "atmo_filter")
return
-obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
+/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
if(..())
return
usr.set_machine(src)
diff --git a/code/game/machinery/airlock_control.dm b/code/game/machinery/airlock_control.dm
index 7a7e2004757..37a4ed4785b 100644
--- a/code/game/machinery/airlock_control.dm
+++ b/code/game/machinery/airlock_control.dm
@@ -148,20 +148,22 @@ obj/machinery/door/airlock/proc/set_frequency(new_frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK)
-obj/machinery/door/airlock/initialize()
+/obj/machinery/door/airlock/initialize()
+ if (!radio_controller)
+ return
if(frequency)
set_frequency(frequency)
update_icon()
-obj/machinery/door/airlock/New()
+/obj/machinery/door/airlock/New()
..()
- if(radio_controller)
- set_frequency(frequency)
+ if(ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
-obj/machinery/airlock_sensor
+/obj/machinery/airlock_sensor
icon = 'icons/obj/airlock_machines.dmi'
icon_state = "airlock_sensor_off"
name = "airlock sensor"
@@ -185,7 +187,7 @@ obj/machinery/airlock_sensor
machine_flags = MULTITOOL_MENU
-obj/machinery/airlock_sensor/update_icon()
+/obj/machinery/airlock_sensor/update_icon()
if(on)
if(alert)
icon_state = "airlock_sensor_alert"
@@ -194,7 +196,7 @@ obj/machinery/airlock_sensor/update_icon()
else
icon_state = "airlock_sensor_off"
-obj/machinery/airlock_sensor/attack_hand(mob/user)
+/obj/machinery/airlock_sensor/attack_hand(mob/user)
if(..())
return
var/datum/signal/signal = getFromPool(/datum/signal)
@@ -205,7 +207,7 @@ obj/machinery/airlock_sensor/attack_hand(mob/user)
radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK)
flick("airlock_sensor_cycle", src)
-obj/machinery/airlock_sensor/process()
+/obj/machinery/airlock_sensor/process()
if(on)
var/datum/signal/signal = getFromPool(/datum/signal)
signal.transmission_method = 1 //radio signal
@@ -223,24 +225,26 @@ obj/machinery/airlock_sensor/process()
update_icon()
-obj/machinery/airlock_sensor/proc/set_frequency(new_frequency)
+/obj/machinery/airlock_sensor/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK)
-obj/machinery/airlock_sensor/initialize()
+/obj/machinery/airlock_sensor/initialize()
+ if (!radio_controller)
+ return
set_frequency(frequency)
-obj/machinery/airlock_sensor/New()
+/obj/machinery/airlock_sensor/New()
..()
- if(radio_controller)
- set_frequency(frequency)
+ if (ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
-obj/machinery/airlock_sensor/airlock_interior
+/obj/machinery/airlock_sensor/airlock_interior
command = "cycle_interior"
-obj/machinery/airlock_sensor/airlock_exterior
+/obj/machinery/airlock_sensor/airlock_exterior
command = "cycle_exterior"
/obj/machinery/airlock_sensor/New(turf/loc, var/ndir, var/building=0)
@@ -261,7 +265,7 @@ obj/machinery/airlock_sensor/airlock_exterior
//stat |= MAINT
//src.update_icon()
-obj/machinery/airlock_sensor/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
+/obj/machinery/airlock_sensor/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
- Frequency: [format_frequency(frequency)] GHz (Reset)
@@ -269,7 +273,7 @@ obj/machinery/airlock_sensor/multitool_menu(var/mob/user,var/obj/item/device/mul
[format_tag("Master ID Tag","master_tag")]
"}
-obj/machinery/airlock_sensor/Topic(href,href_list)
+/obj/machinery/airlock_sensor/Topic(href,href_list)
if(..())
return 0
@@ -292,7 +296,7 @@ obj/machinery/airlock_sensor/Topic(href,href_list)
update_multitool_menu(usr)
-obj/machinery/airlock_sensor/attackby(var/obj/item/W, var/mob/user)
+/obj/machinery/airlock_sensor/attackby(var/obj/item/W, var/mob/user)
. = ..()
if(.)
return .
@@ -303,7 +307,7 @@ obj/machinery/airlock_sensor/attackby(var/obj/item/W, var/mob/user)
new /obj/item/mounted/frame/airlock_sensor(get_turf(src))
qdel(src)
-obj/machinery/access_button
+/obj/machinery/access_button
icon = 'icons/obj/airlock_machines.dmi'
icon_state = "access_button_standby"
name = "access button"
@@ -347,14 +351,14 @@ obj/machinery/access_button
//src.update_icon()
-obj/machinery/access_button/update_icon()
+/obj/machinery/access_button/update_icon()
if(on)
icon_state = "access_button_standby"
else
icon_state = "access_button_off"
-obj/machinery/access_button/attack_hand(mob/user)
+/obj/machinery/access_button/attack_hand(mob/user)
add_fingerprint(usr)
playsound(src,'sound/misc/click.ogg',30,0,-1)
if(!allowed(user))
@@ -371,7 +375,7 @@ obj/machinery/access_button/attack_hand(mob/user)
flick("access_button_cycle", src)
-obj/machinery/access_button/attackby(var/obj/item/W, var/mob/user)
+/obj/machinery/access_button/attackby(var/obj/item/W, var/mob/user)
. = ..()
if(.)
return .
@@ -382,33 +386,35 @@ obj/machinery/access_button/attackby(var/obj/item/W, var/mob/user)
new /obj/item/mounted/frame/access_button(get_turf(src))
qdel(src)
-obj/machinery/access_button/proc/set_frequency(new_frequency)
+/obj/machinery/access_button/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, customfilter)
-obj/machinery/access_button/initialize()
+/obj/machinery/access_button/initialize()
+ if (!radio_controller)
+ return
set_frequency(frequency)
-obj/machinery/access_button/New()
+/obj/machinery/access_button/New()
..()
- if(radio_controller)
- set_frequency(frequency)
+ if(ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
-obj/machinery/access_button/airlock_interior
+/obj/machinery/access_button/airlock_interior
frequency = 1449
command = "cycle_interior"
-obj/machinery/access_button/airlock_exterior
+/obj/machinery/access_button/airlock_exterior
frequency = 1449
command = "cycle_exterior"
-obj/machinery/access_button/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
+/obj/machinery/access_button/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
return {"
"}
-obj/machinery/access_button/Topic(href,href_list)
+/obj/machinery/access_button/Topic(href,href_list)
if(..())
return 1
@@ -450,4 +456,4 @@ obj/machinery/access_button/Topic(href,href_list)
update_multitool_menu(usr)
-#undef RADIO_FILTER_EXPLANATION
\ No newline at end of file
+#undef RADIO_FILTER_EXPLANATION
diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm
index d553aa3963b..5c346eb4f19 100644
--- a/code/game/machinery/atmo_control.dm
+++ b/code/game/machinery/atmo_control.dm
@@ -104,13 +104,15 @@
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/air_sensor/initialize()
+ if (!radio_controller)
+ return
set_frequency(frequency)
/obj/machinery/air_sensor/New()
..()
- if(radio_controller)
- set_frequency(frequency)
+ if(ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
/obj/machinery/computer/general_air_control
icon = 'icons/obj/computer.dmi'
diff --git a/code/game/machinery/bots/mulebot.dm b/code/game/machinery/bots/mulebot.dm
index 3c55195a021..102a932464e 100644
--- a/code/game/machinery/bots/mulebot.dm
+++ b/code/game/machinery/bots/mulebot.dm
@@ -87,14 +87,14 @@ var/global/mulebot_count = 0
cell = new(src)
cell.charge = 2000
cell.maxcharge = 2000
+ if (ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
- spawn(5) // must wait for map loading to finish
- mulebot_count += 1
- if(!suffix)
- suffix = "#[mulebot_count]"
- name = "\improper Mulebot ([suffix])"
-
-
+/obj/machinery/bot/mulebot/initialize()
+ mulebot_count += 1
+ if(!suffix)
+ suffix = "#[mulebot_count]"
+ name = "\improper Mulebot ([suffix])"
can_load = list(
/obj/structure/closet/crate,
/obj/structure/vendomatpack,
diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm
index 2a1a931ad88..ecd37936568 100644
--- a/code/game/machinery/magnet.dm
+++ b/code/game/machinery/magnet.dm
@@ -33,10 +33,12 @@
var/turf/T = loc
hide(T.intact)
center = T
+ if (ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
- spawn(10) // must wait for map loading to finish
- if(radio_controller)
- radio_controller.add_object(src, freq, RADIO_MAGNETS)
+/obj/machinery/magnetic_module/initialize()
+ if(radio_controller)
+ radio_controller.add_object(src, freq, RADIO_MAGNETS)
spawn()
magnetic_process()
@@ -233,10 +235,12 @@
if(M.freq == frequency && M.code == code)
magnets.Add(M)
+ if (ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
- spawn(45) // must wait for map loading to finish
- if(radio_controller)
- radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS)
+/obj/machinery/magnetic_controller/initialize()
+ if(radio_controller)
+ radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS)
if(path) // check for default path
diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm
index d070b3a4937..101b02c85f8 100644
--- a/code/game/machinery/status_display.dm
+++ b/code/game/machinery/status_display.dm
@@ -58,9 +58,14 @@ var/global/list/status_displays = list() //This list contains both normal status
/obj/machinery/status_display/New()
..()
status_displays |= src
- spawn(5) // must wait for map loading to finish
- if(radio_controller)
- radio_controller.add_object(src, frequency)
+
+ if (ticker && ticker.current_state == GAME_STATE_PLAYING)
+ initialize()
+
+/obj/machinery/status_display/initialize()
+ ..()
+ if(radio_controller)
+ radio_controller.add_object(src, frequency)
/obj/machinery/status_display/Destroy()
.=..()
diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/game/objects/items/devices/PDA/radio.dm
index 81b4118fda5..25a5d14b0a4 100644
--- a/code/game/objects/items/devices/PDA/radio.dm
+++ b/code/game/objects/items/devices/PDA/radio.dm
@@ -21,10 +21,12 @@
/obj/item/radio/integrated/signal/New()
..()
- if(radio_controller)
+ if(ticker && ticker.current_state == GAME_STATE_PLAYING)
initialize()
/obj/item/radio/integrated/signal/initialize()
+ if (!radio_controller)
+ return
if (src.frequency < 1441 || src.frequency > 1489)
src.frequency = sanitize_frequency(src.frequency)
diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm
index 94fc921897f..5781d5b8f12 100644
--- a/code/game/objects/items/devices/radio/headset.dm
+++ b/code/game/objects/items/devices/radio/headset.dm
@@ -15,12 +15,20 @@
var/translate_hive = 0
var/obj/item/device/encryptionkey/keyslot1 = null
var/obj/item/device/encryptionkey/keyslot2 = null
+ var/init_keyslot1_type = /obj/item/device/encryptionkey
+ var/init_keyslot2_type = null
maxf = 1489
/obj/item/device/radio/headset/New()
- ..()
- keyslot1 = new /obj/item/device/encryptionkey/
+ if (init_keyslot1_type)
+ keyslot1 = new init_keyslot1_type(src)
+ if (init_keyslot2_type)
+ keyslot2 = new init_keyslot2_type(src)
+ return ..()
+
+/obj/item/device/radio/headset/initialize()
recalculateChannels()
+ return ..()
/obj/item/device/radio/headset/receive_range(freq, level)
if(ishuman(src.loc))
@@ -31,156 +39,109 @@
/obj/item/device/radio/headset/syndicate
origin_tech = Tc_SYNDICATE + "=3"
-/obj/item/device/radio/headset/syndicate/New()
- ..()
- qdel(keyslot1)
- keyslot1 = new /obj/item/device/encryptionkey/syndicate
syndie = 1
- recalculateChannels()
+ init_keyslot1_type = /obj/item/device/encryptionkey/syndicate
-/obj/item/device/radio/headset/revsquad/New()
- ..()
- keyslot2 = new /obj/item/device/encryptionkey/rev
- syndie = 1 //prevents broadcast without key
+/obj/item/device/radio/headset/revsquad
+ init_keyslot2_type = /obj/item/device/encryptionkey/rev
+ syndie = 1
/obj/item/device/radio/headset/revsquad/emp_act()
return
-/obj/item/device/radio/headset/syndicate/commando/New()
- ..()
+/obj/item/device/radio/headset/syndicate/commando/initialize()
+ . = ..()
set_frequency(SYND_FREQ)
/obj/item/device/radio/headset/raider
// origin_tech = Tc_SYNDICATE + "=3" birds dont have super sekrit spy radios like the syndies have
-/obj/item/device/radio/headset/raider/New()
- ..()
- qdel(keyslot1)
- keyslot1 = new /obj/item/device/encryptionkey/raider
+ init_keyslot1_type = /obj/item/device/encryptionkey/raider
raider = 1
- recalculateChannels()
-/obj/item/device/radio/headset/raider/pretuned/New() // pre tuned radio to 1215 aka raider freq
- ..()
+/obj/item/device/radio/headset/raider/pretuned/initialize() // pre tuned radio to 1215 aka raider freq
+ . = ..()
set_frequency(RAID_FREQ)
-
/obj/item/device/radio/headset/binary
origin_tech = Tc_SYNDICATE + "=3"
-/obj/item/device/radio/headset/binary/New()
- ..()
- qdel(keyslot1)
- keyslot1 = new /obj/item/device/encryptionkey/binary
- recalculateChannels()
+ init_keyslot1_type = /obj/item/device/encryptionkey/binary
/obj/item/device/radio/headset/headset_sec
name = "security radio headset"
desc = "This is used by your elite security force. To access the security channel, use :s."
icon_state = "sec_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_sec/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_sec(src)
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_sec
/obj/item/device/radio/headset/headset_eng
name = "engineering radio headset"
desc = "When the engineers wish to chat like girls. To access the engineering channel, use :e. "
icon_state = "eng_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_eng/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_eng
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_eng
/obj/item/device/radio/headset/headset_rob
name = "robotics radio headset"
desc = "Made specifically for the roboticists who cannot decide between departments. To access the engineering channel, use :e. For research, use :n."
icon_state = "rob_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_rob/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_rob
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_rob
/obj/item/device/radio/headset/headset_med
name = "medical radio headset"
desc = "A headset for the trained staff of the medbay. To access the medical channel, use :m."
icon_state = "med_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_med/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_med
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_med
/obj/item/device/radio/headset/headset_sci
name = "science radio headset"
desc = "A sciency headset. Like usual. To access the science channel, use :n."
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_sci/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_sci
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_sci
/obj/item/device/radio/headset/headset_medsci
name = "medical research radio headset"
desc = "A headset that is a result of the mating between medical and science. To access the medical channel, use :m. For science, use :n."
icon_state = "med_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_medsci/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_medsci
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_medsci
/obj/item/device/radio/headset/headset_com
name = "command radio headset"
desc = "A headset with a commanding channel. To access the command channel, use :c."
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_com/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_com
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_com
/obj/item/device/radio/headset/heads/captain
name = "captain's headset"
desc = "The headset of the boss. Channels are as follows: :c - command, :s - security, :e - engineering, :u - supply, :d - service, :m - medical, :n - science."
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/heads/captain/New()
- keyslot2 = new /obj/item/device/encryptionkey/heads/captain
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/heads/captain
/obj/item/device/radio/headset/heads/rd
name = "Research Director's headset"
desc = "Headset of the researching God. To access the science channel, use :n. For command, use :c."
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/heads/rd/New()
- keyslot2 = new /obj/item/device/encryptionkey/heads/rd
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/heads/rd
/obj/item/device/radio/headset/heads/hos
name = "head of security's headset"
desc = "The headset of the man who protects your worthless lifes. To access the security channel, use :s. For command, use :c."
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/heads/hos/New()
- keyslot2 = new /obj/item/device/encryptionkey/heads/hos
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/heads/hos
/obj/item/device/radio/headset/heads/ce
name = "chief engineer's headset"
desc = "The headset of the guy who is in charge of morons. To access the engineering channel, use :e. For command, use :c."
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/heads/ce/New()
- keyslot2 = new /obj/item/device/encryptionkey/heads/ce
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/heads/ce
/obj/item/device/radio/headset/heads/cmo
name = "chief medical officer's headset"
@@ -188,70 +149,49 @@
icon_state = "com_headset"
item_state = "headset"
sterility = 100
-
-/obj/item/device/radio/headset/heads/cmo/New()
- keyslot2 = new /obj/item/device/encryptionkey/heads/cmo
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/heads/cmo
/obj/item/device/radio/headset/heads/hop
name = "head of personnel's headset"
desc = "The headset of the guy who will one day be captain. Channels are as follows: :u - supply, :d - service, :c - command, :s - security"
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/heads/hop/New()
- keyslot2 = new /obj/item/device/encryptionkey/heads/hop
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/heads/hop
/obj/item/device/radio/headset/headset_cargo
name = "supply radio headset"
desc = "A headset used by the QM and his slaves. To access the supply channel, use :u."
icon_state = "cargo_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_cargo/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_cargo
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_cargo
/obj/item/device/radio/headset/headset_mining
name = "supply radio headset"
desc = "A headset used by the shaft miners to be yelled at from the QM and R&D at the same time. Channels are as follows: :u - supply, :n - science"
icon_state = "mine_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_mining/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_mining
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_mining
/obj/item/device/radio/headset/headset_service
name = "service radio headset"
desc = "A headset used by the chef, the bartender and the botanists to plan their poisoning of the entire crew. To access the service channel, use :d."
icon_state = "service_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_service/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_service
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_service
/obj/item/device/radio/headset/headset_engsci
name = "research engineering radio headset"
desc = "A headset used to gossip about engineering to the science crew, and about science to the engineering crew. To access the engineering channel, use :e. For science, use :n."
icon_state = "eng_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_engsci/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_engsci
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_engsci
/obj/item/device/radio/headset/headset_servsci
name = "research service radio headset"
desc = "A headset used to talk to botanists and scientists. To access the science channel, use :n. For service, use :d."
icon_state = "com_headset"
item_state = "headset"
-
-/obj/item/device/radio/headset/headset_servsci/New()
- keyslot2 = new /obj/item/device/encryptionkey/headset_servsci
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/headset_servsci
/obj/item/device/radio/headset/headset_earmuffs
name = "headset earmuffs"
@@ -260,20 +200,13 @@
icon_state = "headset_earmuffs"
item_state = "earmuffs"
-/obj/item/device/radio/headset/headset_earmuffs/New()
- //keyslot2 = new /obj/item/device/encryptionkey/headset_serveng
- ..()
-
/obj/item/device/radio/headset/deathsquad
name = "Deathsquad headset"
desc = "A headset used by the dark side of Nanotrasen's Spec Ops. Channels are as follows: :0 - Deathsquad :c - command, :s - security, :e - engineering, :d - mining, :q - cargo, :m - medical, :n - science."
icon_state = "deathsquad_headset"
item_state = "headset"
freerange = 1
-
-/obj/item/device/radio/headset/deathsquad/New()
- keyslot2 = new /obj/item/device/encryptionkey/deathsquad
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/deathsquad
/obj/item/device/radio/headset/ert
name = "CentCom Response Team headset"
@@ -281,10 +214,7 @@
icon_state = "ert_headset"
item_state = "headset"
freerange = 1
-
-/obj/item/device/radio/headset/ert/New()
- keyslot2 = new /obj/item/device/encryptionkey/ert
- ..()
+ init_keyslot2_type = /obj/item/device/encryptionkey/ert
/obj/item/device/radio/headset/attackby(obj/item/weapon/W, mob/user)
// ..()
@@ -389,14 +319,6 @@
for (var/ch_name in channels)
- //this is the most hilarious piece of code i have seen this week, so im not going to remove it
- /*
- if(!radio_controller)
- sleep(30) // Waiting for the radio_controller to be created.
- if(!radio_controller)
- src.name = "broken radio headset"
- return
- */
secure_radio_connections[ch_name] = add_radio(src, radiochannels[ch_name])
return
diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm
index de435da6600..ebc6602352d 100644
--- a/code/game/objects/items/devices/radio/radio.dm
+++ b/code/game/objects/items/devices/radio/radio.dm
@@ -50,8 +50,8 @@
wires.CutWireIndex(WIRE_TRANSMIT)
secure_radio_connections = new
- ..(loc)
- if(radio_controller)
+ ..()
+ if(ticker && ticker.current_state != GAME_STATE_PREGAME) // So that equipped headset during set up are correctly initialized.
initialize()
/obj/item/device/radio/Destroy()
@@ -59,8 +59,8 @@
remove_radio_all(src) //Just to be sure
..()
-
/obj/item/device/radio/initialize()
+ . = ..()
frequency = COMMON_FREQ //common chat
if(freerange)
if(frequency < 1200 || frequency > 1600)
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 8eba04078ab..62eb4042962 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -51,7 +51,8 @@
for(var/path in to_spawn)
var/amount = to_spawn[path] || 1
for(var/i in 1 to amount)
- new path(src)
+ var/atom/A = new path(src)
+ A.initialize() // recursive
/obj/structure/closet/basic
has_lock_type = /obj/structure/closet/secure_closet/basic
@@ -90,7 +91,7 @@
for(var/obj/structure/closet/closet in get_turf(src))
if(closet != src && !closet.wall_mounted)
return 0
-
+
for(var/mob/living/carbon/carbon in src.loc)
if (carbon.mutual_handcuffs)
if (carbon.mutual_handcuffed_to.loc == src.loc || carbon.loc == src.loc)
@@ -661,4 +662,4 @@
/obj/structure/closet/loot/Destroy()
for (var/datum/faction/vox_shoal/VS in ticker.mode.factions)
VS.our_bounty_lockers -= src
- return ..()
\ No newline at end of file
+ return ..()