Working version of radio controller fixes (#26914)

* Revert "Revert "Fixes oldcoder stuff with radio controllers (#26845)" (#26868)"

This reverts commit cb1613403b.

* Fixes the bag

* No bug
This commit is contained in:
ShiftyRail
2020-06-21 05:39:36 +02:00
committed by GitHub
parent 253e4b1fca
commit 8021aaf539
10 changed files with 128 additions and 184 deletions

View File

@@ -26,18 +26,18 @@ Filter types:
ex_node_offset = 5 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) radio_controller.remove_object(src, frequency)
frequency = new_frequency frequency = new_frequency
if(frequency) if(frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
obj/machinery/atmospherics/trinary/filter/New() /obj/machinery/atmospherics/trinary/filter/New()
if(radio_controller) if(ticker && ticker.current_state == GAME_STATE_PLAYING)
initialize() initialize()
..() ..()
obj/machinery/atmospherics/trinary/filter/update_icon() /obj/machinery/atmospherics/trinary/filter/update_icon()
if(stat & NOPOWER) if(stat & NOPOWER)
icon_state = "hintact_off" icon_state = "hintact_off"
else if(node2 && node3 && node1) else if(node2 && node3 && node1)
@@ -47,14 +47,14 @@ obj/machinery/atmospherics/trinary/filter/update_icon()
on = 0 on = 0
..() ..()
obj/machinery/atmospherics/trinary/filter/power_change() /obj/machinery/atmospherics/trinary/filter/power_change()
var/old_stat = stat var/old_stat = stat
..() ..()
if(old_stat != stat) if(old_stat != stat)
on = !on on = !on
update_icon() update_icon()
obj/machinery/atmospherics/trinary/filter/process() /obj/machinery/atmospherics/trinary/filter/process()
. = ..() . = ..()
if(!on) if(!on)
return return
@@ -109,12 +109,14 @@ obj/machinery/atmospherics/trinary/filter/process()
return 1 return 1
obj/machinery/atmospherics/trinary/filter/initialize() /obj/machinery/atmospherics/trinary/filter/initialize()
if (!radio_controller)
return
set_frequency(frequency) 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(..()) if(..())
return return
@@ -167,7 +169,7 @@ obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
onclose(user, "atmo_filter") onclose(user, "atmo_filter")
return return
obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE /obj/machinery/atmospherics/trinary/filter/Topic(href, href_list) // -- TLE
if(..()) if(..())
return return
usr.set_machine(src) usr.set_machine(src)

View File

@@ -148,20 +148,22 @@ obj/machinery/door/airlock/proc/set_frequency(new_frequency)
radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) 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) if(frequency)
set_frequency(frequency) set_frequency(frequency)
update_icon() update_icon()
obj/machinery/door/airlock/New() /obj/machinery/door/airlock/New()
..() ..()
if(radio_controller) if(ticker && ticker.current_state == GAME_STATE_PLAYING)
set_frequency(frequency) initialize()
obj/machinery/airlock_sensor /obj/machinery/airlock_sensor
icon = 'icons/obj/airlock_machines.dmi' icon = 'icons/obj/airlock_machines.dmi'
icon_state = "airlock_sensor_off" icon_state = "airlock_sensor_off"
name = "airlock sensor" name = "airlock sensor"
@@ -185,7 +187,7 @@ obj/machinery/airlock_sensor
machine_flags = MULTITOOL_MENU machine_flags = MULTITOOL_MENU
obj/machinery/airlock_sensor/update_icon() /obj/machinery/airlock_sensor/update_icon()
if(on) if(on)
if(alert) if(alert)
icon_state = "airlock_sensor_alert" icon_state = "airlock_sensor_alert"
@@ -194,7 +196,7 @@ obj/machinery/airlock_sensor/update_icon()
else else
icon_state = "airlock_sensor_off" icon_state = "airlock_sensor_off"
obj/machinery/airlock_sensor/attack_hand(mob/user) /obj/machinery/airlock_sensor/attack_hand(mob/user)
if(..()) if(..())
return return
var/datum/signal/signal = getFromPool(/datum/signal) 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) radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK)
flick("airlock_sensor_cycle", src) flick("airlock_sensor_cycle", src)
obj/machinery/airlock_sensor/process() /obj/machinery/airlock_sensor/process()
if(on) if(on)
var/datum/signal/signal = getFromPool(/datum/signal) var/datum/signal/signal = getFromPool(/datum/signal)
signal.transmission_method = 1 //radio signal signal.transmission_method = 1 //radio signal
@@ -223,24 +225,26 @@ obj/machinery/airlock_sensor/process()
update_icon() 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) radio_controller.remove_object(src, frequency)
frequency = new_frequency frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, RADIO_AIRLOCK) 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) set_frequency(frequency)
obj/machinery/airlock_sensor/New() /obj/machinery/airlock_sensor/New()
..() ..()
if(radio_controller) if (ticker && ticker.current_state == GAME_STATE_PLAYING)
set_frequency(frequency) initialize()
obj/machinery/airlock_sensor/airlock_interior /obj/machinery/airlock_sensor/airlock_interior
command = "cycle_interior" command = "cycle_interior"
obj/machinery/airlock_sensor/airlock_exterior /obj/machinery/airlock_sensor/airlock_exterior
command = "cycle_exterior" command = "cycle_exterior"
/obj/machinery/airlock_sensor/New(turf/loc, var/ndir, var/building=0) /obj/machinery/airlock_sensor/New(turf/loc, var/ndir, var/building=0)
@@ -261,7 +265,7 @@ obj/machinery/airlock_sensor/airlock_exterior
//stat |= MAINT //stat |= MAINT
//src.update_icon() //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 {" return {"
<ul> <ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[0]">Reset</a>)</li> <li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[0]">Reset</a>)</li>
@@ -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")] [format_tag("Master ID Tag","master_tag")]
</ul>"} </ul>"}
obj/machinery/airlock_sensor/Topic(href,href_list) /obj/machinery/airlock_sensor/Topic(href,href_list)
if(..()) if(..())
return 0 return 0
@@ -292,7 +296,7 @@ obj/machinery/airlock_sensor/Topic(href,href_list)
update_multitool_menu(usr) 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(.) if(.)
return . 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)) new /obj/item/mounted/frame/airlock_sensor(get_turf(src))
qdel(src) qdel(src)
obj/machinery/access_button /obj/machinery/access_button
icon = 'icons/obj/airlock_machines.dmi' icon = 'icons/obj/airlock_machines.dmi'
icon_state = "access_button_standby" icon_state = "access_button_standby"
name = "access button" name = "access button"
@@ -347,14 +351,14 @@ obj/machinery/access_button
//src.update_icon() //src.update_icon()
obj/machinery/access_button/update_icon() /obj/machinery/access_button/update_icon()
if(on) if(on)
icon_state = "access_button_standby" icon_state = "access_button_standby"
else else
icon_state = "access_button_off" icon_state = "access_button_off"
obj/machinery/access_button/attack_hand(mob/user) /obj/machinery/access_button/attack_hand(mob/user)
add_fingerprint(usr) add_fingerprint(usr)
playsound(src,'sound/misc/click.ogg',30,0,-1) playsound(src,'sound/misc/click.ogg',30,0,-1)
if(!allowed(user)) if(!allowed(user))
@@ -371,7 +375,7 @@ obj/machinery/access_button/attack_hand(mob/user)
flick("access_button_cycle", src) 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(.) if(.)
return . 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)) new /obj/item/mounted/frame/access_button(get_turf(src))
qdel(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) radio_controller.remove_object(src, frequency)
frequency = new_frequency frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, customfilter) 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) set_frequency(frequency)
obj/machinery/access_button/New() /obj/machinery/access_button/New()
..() ..()
if(radio_controller) if(ticker && ticker.current_state == GAME_STATE_PLAYING)
set_frequency(frequency) initialize()
obj/machinery/access_button/airlock_interior /obj/machinery/access_button/airlock_interior
frequency = 1449 frequency = 1449
command = "cycle_interior" command = "cycle_interior"
obj/machinery/access_button/airlock_exterior /obj/machinery/access_button/airlock_exterior
frequency = 1449 frequency = 1449
command = "cycle_exterior" 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 {" return {"
<ul> <ul>
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[0]">Reset</a>)</li> <li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[0]">Reset</a>)</li>
@@ -417,7 +423,7 @@ obj/machinery/access_button/multitool_menu(var/mob/user,var/obj/item/device/mult
<li><b>Filter:</b> <a href="?src=\ref[src];set_filter=-1">[customfilter]</a></li> <li><b>Filter:</b> <a href="?src=\ref[src];set_filter=-1">[customfilter]</a></li>
</ul>"} </ul>"}
obj/machinery/access_button/Topic(href,href_list) /obj/machinery/access_button/Topic(href,href_list)
if(..()) if(..())
return 1 return 1
@@ -450,4 +456,4 @@ obj/machinery/access_button/Topic(href,href_list)
update_multitool_menu(usr) update_multitool_menu(usr)
#undef RADIO_FILTER_EXPLANATION #undef RADIO_FILTER_EXPLANATION

View File

@@ -104,13 +104,15 @@
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA) radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/air_sensor/initialize() /obj/machinery/air_sensor/initialize()
if (!radio_controller)
return
set_frequency(frequency) set_frequency(frequency)
/obj/machinery/air_sensor/New() /obj/machinery/air_sensor/New()
..() ..()
if(radio_controller) if(ticker && ticker.current_state == GAME_STATE_PLAYING)
set_frequency(frequency) initialize()
/obj/machinery/computer/general_air_control /obj/machinery/computer/general_air_control
icon = 'icons/obj/computer.dmi' icon = 'icons/obj/computer.dmi'

View File

@@ -87,14 +87,14 @@ var/global/mulebot_count = 0
cell = new(src) cell = new(src)
cell.charge = 2000 cell.charge = 2000
cell.maxcharge = 2000 cell.maxcharge = 2000
if (ticker && ticker.current_state == GAME_STATE_PLAYING)
initialize()
spawn(5) // must wait for map loading to finish /obj/machinery/bot/mulebot/initialize()
mulebot_count += 1 mulebot_count += 1
if(!suffix) if(!suffix)
suffix = "#[mulebot_count]" suffix = "#[mulebot_count]"
name = "\improper Mulebot ([suffix])" name = "\improper Mulebot ([suffix])"
can_load = list( can_load = list(
/obj/structure/closet/crate, /obj/structure/closet/crate,
/obj/structure/vendomatpack, /obj/structure/vendomatpack,

View File

@@ -33,10 +33,12 @@
var/turf/T = loc var/turf/T = loc
hide(T.intact) hide(T.intact)
center = T center = T
if (ticker && ticker.current_state == GAME_STATE_PLAYING)
initialize()
spawn(10) // must wait for map loading to finish /obj/machinery/magnetic_module/initialize()
if(radio_controller) if(radio_controller)
radio_controller.add_object(src, freq, RADIO_MAGNETS) radio_controller.add_object(src, freq, RADIO_MAGNETS)
spawn() spawn()
magnetic_process() magnetic_process()
@@ -233,10 +235,12 @@
if(M.freq == frequency && M.code == code) if(M.freq == frequency && M.code == code)
magnets.Add(M) magnets.Add(M)
if (ticker && ticker.current_state == GAME_STATE_PLAYING)
initialize()
spawn(45) // must wait for map loading to finish /obj/machinery/magnetic_controller/initialize()
if(radio_controller) if(radio_controller)
radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS) radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS)
if(path) // check for default path if(path) // check for default path

View File

@@ -58,9 +58,14 @@ var/global/list/status_displays = list() //This list contains both normal status
/obj/machinery/status_display/New() /obj/machinery/status_display/New()
..() ..()
status_displays |= src status_displays |= src
spawn(5) // must wait for map loading to finish
if(radio_controller) if (ticker && ticker.current_state == GAME_STATE_PLAYING)
radio_controller.add_object(src, frequency) initialize()
/obj/machinery/status_display/initialize()
..()
if(radio_controller)
radio_controller.add_object(src, frequency)
/obj/machinery/status_display/Destroy() /obj/machinery/status_display/Destroy()
.=..() .=..()

View File

@@ -21,10 +21,12 @@
/obj/item/radio/integrated/signal/New() /obj/item/radio/integrated/signal/New()
..() ..()
if(radio_controller) if(ticker && ticker.current_state == GAME_STATE_PLAYING)
initialize() initialize()
/obj/item/radio/integrated/signal/initialize() /obj/item/radio/integrated/signal/initialize()
if (!radio_controller)
return
if (src.frequency < 1441 || src.frequency > 1489) if (src.frequency < 1441 || src.frequency > 1489)
src.frequency = sanitize_frequency(src.frequency) src.frequency = sanitize_frequency(src.frequency)

View File

@@ -15,12 +15,20 @@
var/translate_hive = 0 var/translate_hive = 0
var/obj/item/device/encryptionkey/keyslot1 = null var/obj/item/device/encryptionkey/keyslot1 = null
var/obj/item/device/encryptionkey/keyslot2 = null var/obj/item/device/encryptionkey/keyslot2 = null
var/init_keyslot1_type = /obj/item/device/encryptionkey
var/init_keyslot2_type = null
maxf = 1489 maxf = 1489
/obj/item/device/radio/headset/New() /obj/item/device/radio/headset/New()
..() if (init_keyslot1_type)
keyslot1 = new /obj/item/device/encryptionkey/ keyslot1 = new init_keyslot1_type(src)
if (init_keyslot2_type)
keyslot2 = new init_keyslot2_type(src)
return ..()
/obj/item/device/radio/headset/initialize()
recalculateChannels() recalculateChannels()
return ..()
/obj/item/device/radio/headset/receive_range(freq, level) /obj/item/device/radio/headset/receive_range(freq, level)
if(ishuman(src.loc)) if(ishuman(src.loc))
@@ -31,156 +39,109 @@
/obj/item/device/radio/headset/syndicate /obj/item/device/radio/headset/syndicate
origin_tech = Tc_SYNDICATE + "=3" origin_tech = Tc_SYNDICATE + "=3"
/obj/item/device/radio/headset/syndicate/New()
..()
qdel(keyslot1)
keyslot1 = new /obj/item/device/encryptionkey/syndicate
syndie = 1 syndie = 1
recalculateChannels() init_keyslot1_type = /obj/item/device/encryptionkey/syndicate
/obj/item/device/radio/headset/revsquad/New() /obj/item/device/radio/headset/revsquad
..() init_keyslot2_type = /obj/item/device/encryptionkey/rev
keyslot2 = new /obj/item/device/encryptionkey/rev syndie = 1
syndie = 1 //prevents broadcast without key
/obj/item/device/radio/headset/revsquad/emp_act() /obj/item/device/radio/headset/revsquad/emp_act()
return return
/obj/item/device/radio/headset/syndicate/commando/New() /obj/item/device/radio/headset/syndicate/commando/initialize()
..() . = ..()
set_frequency(SYND_FREQ) set_frequency(SYND_FREQ)
/obj/item/device/radio/headset/raider /obj/item/device/radio/headset/raider
// origin_tech = Tc_SYNDICATE + "=3" birds dont have super sekrit spy radios like the syndies have // origin_tech = Tc_SYNDICATE + "=3" birds dont have super sekrit spy radios like the syndies have
/obj/item/device/radio/headset/raider/New() init_keyslot1_type = /obj/item/device/encryptionkey/raider
..()
qdel(keyslot1)
keyslot1 = new /obj/item/device/encryptionkey/raider
raider = 1 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) set_frequency(RAID_FREQ)
/obj/item/device/radio/headset/binary /obj/item/device/radio/headset/binary
origin_tech = Tc_SYNDICATE + "=3" origin_tech = Tc_SYNDICATE + "=3"
/obj/item/device/radio/headset/binary/New() init_keyslot1_type = /obj/item/device/encryptionkey/binary
..()
qdel(keyslot1)
keyslot1 = new /obj/item/device/encryptionkey/binary
recalculateChannels()
/obj/item/device/radio/headset/headset_sec /obj/item/device/radio/headset/headset_sec
name = "security radio headset" name = "security radio headset"
desc = "This is used by your elite security force. To access the security channel, use :s." desc = "This is used by your elite security force. To access the security channel, use :s."
icon_state = "sec_headset" icon_state = "sec_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_sec
/obj/item/device/radio/headset/headset_sec/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_sec(src)
..()
/obj/item/device/radio/headset/headset_eng /obj/item/device/radio/headset/headset_eng
name = "engineering radio headset" name = "engineering radio headset"
desc = "When the engineers wish to chat like girls. To access the engineering channel, use :e. " desc = "When the engineers wish to chat like girls. To access the engineering channel, use :e. "
icon_state = "eng_headset" icon_state = "eng_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_eng
/obj/item/device/radio/headset/headset_eng/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_eng
..()
/obj/item/device/radio/headset/headset_rob /obj/item/device/radio/headset/headset_rob
name = "robotics radio headset" 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." 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" icon_state = "rob_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_rob
/obj/item/device/radio/headset/headset_rob/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_rob
..()
/obj/item/device/radio/headset/headset_med /obj/item/device/radio/headset/headset_med
name = "medical radio headset" name = "medical radio headset"
desc = "A headset for the trained staff of the medbay. To access the medical channel, use :m." desc = "A headset for the trained staff of the medbay. To access the medical channel, use :m."
icon_state = "med_headset" icon_state = "med_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_med
/obj/item/device/radio/headset/headset_med/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_med
..()
/obj/item/device/radio/headset/headset_sci /obj/item/device/radio/headset/headset_sci
name = "science radio headset" name = "science radio headset"
desc = "A sciency headset. Like usual. To access the science channel, use :n." desc = "A sciency headset. Like usual. To access the science channel, use :n."
icon_state = "com_headset" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_sci
/obj/item/device/radio/headset/headset_sci/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_sci
..()
/obj/item/device/radio/headset/headset_medsci /obj/item/device/radio/headset/headset_medsci
name = "medical research radio headset" 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." 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" icon_state = "med_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_medsci
/obj/item/device/radio/headset/headset_medsci/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_medsci
..()
/obj/item/device/radio/headset/headset_com /obj/item/device/radio/headset/headset_com
name = "command radio headset" name = "command radio headset"
desc = "A headset with a commanding channel. To access the command channel, use :c." desc = "A headset with a commanding channel. To access the command channel, use :c."
icon_state = "com_headset" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_com
/obj/item/device/radio/headset/headset_com/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_com
..()
/obj/item/device/radio/headset/heads/captain /obj/item/device/radio/headset/heads/captain
name = "captain's headset" 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." 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" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/heads/captain
/obj/item/device/radio/headset/heads/captain/New()
keyslot2 = new /obj/item/device/encryptionkey/heads/captain
..()
/obj/item/device/radio/headset/heads/rd /obj/item/device/radio/headset/heads/rd
name = "Research Director's headset" name = "Research Director's headset"
desc = "Headset of the researching God. To access the science channel, use :n. For command, use :c." desc = "Headset of the researching God. To access the science channel, use :n. For command, use :c."
icon_state = "com_headset" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/heads/rd
/obj/item/device/radio/headset/heads/rd/New()
keyslot2 = new /obj/item/device/encryptionkey/heads/rd
..()
/obj/item/device/radio/headset/heads/hos /obj/item/device/radio/headset/heads/hos
name = "head of security's headset" 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." 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" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/heads/hos
/obj/item/device/radio/headset/heads/hos/New()
keyslot2 = new /obj/item/device/encryptionkey/heads/hos
..()
/obj/item/device/radio/headset/heads/ce /obj/item/device/radio/headset/heads/ce
name = "chief engineer's headset" 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." 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" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/heads/ce
/obj/item/device/radio/headset/heads/ce/New()
keyslot2 = new /obj/item/device/encryptionkey/heads/ce
..()
/obj/item/device/radio/headset/heads/cmo /obj/item/device/radio/headset/heads/cmo
name = "chief medical officer's headset" name = "chief medical officer's headset"
@@ -188,70 +149,49 @@
icon_state = "com_headset" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
sterility = 100 sterility = 100
init_keyslot2_type = /obj/item/device/encryptionkey/heads/cmo
/obj/item/device/radio/headset/heads/cmo/New()
keyslot2 = new /obj/item/device/encryptionkey/heads/cmo
..()
/obj/item/device/radio/headset/heads/hop /obj/item/device/radio/headset/heads/hop
name = "head of personnel's headset" 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" 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" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/heads/hop
/obj/item/device/radio/headset/heads/hop/New()
keyslot2 = new /obj/item/device/encryptionkey/heads/hop
..()
/obj/item/device/radio/headset/headset_cargo /obj/item/device/radio/headset/headset_cargo
name = "supply radio headset" name = "supply radio headset"
desc = "A headset used by the QM and his slaves. To access the supply channel, use :u." desc = "A headset used by the QM and his slaves. To access the supply channel, use :u."
icon_state = "cargo_headset" icon_state = "cargo_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_cargo
/obj/item/device/radio/headset/headset_cargo/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_cargo
..()
/obj/item/device/radio/headset/headset_mining /obj/item/device/radio/headset/headset_mining
name = "supply radio headset" 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" 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" icon_state = "mine_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_mining
/obj/item/device/radio/headset/headset_mining/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_mining
..()
/obj/item/device/radio/headset/headset_service /obj/item/device/radio/headset/headset_service
name = "service radio headset" 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." 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" icon_state = "service_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_service
/obj/item/device/radio/headset/headset_service/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_service
..()
/obj/item/device/radio/headset/headset_engsci /obj/item/device/radio/headset/headset_engsci
name = "research engineering radio headset" 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." 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" icon_state = "eng_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_engsci
/obj/item/device/radio/headset/headset_engsci/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_engsci
..()
/obj/item/device/radio/headset/headset_servsci /obj/item/device/radio/headset/headset_servsci
name = "research service radio headset" 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." 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" icon_state = "com_headset"
item_state = "headset" item_state = "headset"
init_keyslot2_type = /obj/item/device/encryptionkey/headset_servsci
/obj/item/device/radio/headset/headset_servsci/New()
keyslot2 = new /obj/item/device/encryptionkey/headset_servsci
..()
/obj/item/device/radio/headset/headset_earmuffs /obj/item/device/radio/headset/headset_earmuffs
name = "headset earmuffs" name = "headset earmuffs"
@@ -260,20 +200,13 @@
icon_state = "headset_earmuffs" icon_state = "headset_earmuffs"
item_state = "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 /obj/item/device/radio/headset/deathsquad
name = "Deathsquad headset" 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." 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" icon_state = "deathsquad_headset"
item_state = "headset" item_state = "headset"
freerange = 1 freerange = 1
init_keyslot2_type = /obj/item/device/encryptionkey/deathsquad
/obj/item/device/radio/headset/deathsquad/New()
keyslot2 = new /obj/item/device/encryptionkey/deathsquad
..()
/obj/item/device/radio/headset/ert /obj/item/device/radio/headset/ert
name = "CentCom Response Team headset" name = "CentCom Response Team headset"
@@ -281,10 +214,7 @@
icon_state = "ert_headset" icon_state = "ert_headset"
item_state = "headset" item_state = "headset"
freerange = 1 freerange = 1
init_keyslot2_type = /obj/item/device/encryptionkey/ert
/obj/item/device/radio/headset/ert/New()
keyslot2 = new /obj/item/device/encryptionkey/ert
..()
/obj/item/device/radio/headset/attackby(obj/item/weapon/W, mob/user) /obj/item/device/radio/headset/attackby(obj/item/weapon/W, mob/user)
// ..() // ..()
@@ -389,14 +319,6 @@
for (var/ch_name in channels) 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]) secure_radio_connections[ch_name] = add_radio(src, radiochannels[ch_name])
return return

View File

@@ -50,8 +50,8 @@
wires.CutWireIndex(WIRE_TRANSMIT) wires.CutWireIndex(WIRE_TRANSMIT)
secure_radio_connections = new 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() initialize()
/obj/item/device/radio/Destroy() /obj/item/device/radio/Destroy()
@@ -59,8 +59,8 @@
remove_radio_all(src) //Just to be sure remove_radio_all(src) //Just to be sure
..() ..()
/obj/item/device/radio/initialize() /obj/item/device/radio/initialize()
. = ..()
frequency = COMMON_FREQ //common chat frequency = COMMON_FREQ //common chat
if(freerange) if(freerange)
if(frequency < 1200 || frequency > 1600) if(frequency < 1200 || frequency > 1600)

View File

@@ -51,7 +51,8 @@
for(var/path in to_spawn) for(var/path in to_spawn)
var/amount = to_spawn[path] || 1 var/amount = to_spawn[path] || 1
for(var/i in 1 to amount) for(var/i in 1 to amount)
new path(src) var/atom/A = new path(src)
A.initialize() // recursive
/obj/structure/closet/basic /obj/structure/closet/basic
has_lock_type = /obj/structure/closet/secure_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)) for(var/obj/structure/closet/closet in get_turf(src))
if(closet != src && !closet.wall_mounted) if(closet != src && !closet.wall_mounted)
return 0 return 0
for(var/mob/living/carbon/carbon in src.loc) for(var/mob/living/carbon/carbon in src.loc)
if (carbon.mutual_handcuffs) if (carbon.mutual_handcuffs)
if (carbon.mutual_handcuffed_to.loc == src.loc || carbon.loc == src.loc) if (carbon.mutual_handcuffed_to.loc == src.loc || carbon.loc == src.loc)
@@ -661,4 +662,4 @@
/obj/structure/closet/loot/Destroy() /obj/structure/closet/loot/Destroy()
for (var/datum/faction/vox_shoal/VS in ticker.mode.factions) for (var/datum/faction/vox_shoal/VS in ticker.mode.factions)
VS.our_bounty_lockers -= src VS.our_bounty_lockers -= src
return ..() return ..()