diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 7ad0978a847..26659cd4bf3 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -5,14 +5,14 @@ icon_state = "headset" item_state = null //To remove the radio's state matter = list(MAT_STEEL = 75) - subspace_transmission = 1 + subspace_transmission = TRUE canhear_range = 0 // can't hear headsets from very far away slot_flags = SLOT_EARS sprite_sheets = list(SPECIES_TESHARI = 'icons/inventory/ears/mob_teshari.dmi', SPECIES_WEREBEAST = 'icons/inventory/ears/mob_vr_werebeast.dmi') - var/translate_binary = 0 - var/translate_hive = 0 + var/translate_binary = FALSE + var/translate_hive = FALSE var/obj/item/encryptionkey/keyslot1 = null var/obj/item/encryptionkey/keyslot2 = null var/ks1type = null @@ -21,14 +21,20 @@ drop_sound = 'sound/items/drop/component.ogg' pickup_sound = 'sound/items/pickup/component.ogg' -/obj/item/radio/headset/New() - ..() - internal_channels.Cut() +/obj/item/radio/headset/Initialize() + . = ..() + return INITIALIZE_HINT_LATELOAD + +/obj/item/radio/headset/LateInitialize() + if(internal_channels) //EVERYTHING breaks without this check. + internal_channels.Cut() if(ks1type) keyslot1 = new ks1type(src) if(ks2type) keyslot2 = new ks2type(src) - recalculateChannels(1) + if(!ks1type && !ks2type) //This is here because LateInitialize is being called TWICE for some reason on character spawn + return + recalculateChannels(TRUE) /obj/item/radio/headset/Destroy() qdel(keyslot1) @@ -140,11 +146,11 @@ return -/obj/item/radio/headset/recalculateChannels(var/setDescription = 0) +/obj/item/radio/headset/recalculateChannels(var/setDescription = FALSE) src.channels = list() - src.translate_binary = 0 - src.translate_hive = 0 - src.syndie = 0 + src.translate_binary = FALSE + src.translate_hive = FALSE + src.syndie = FALSE if(keyslot1) for(var/ch_name in keyslot1.channels) @@ -154,13 +160,13 @@ src.channels[ch_name] = keyslot1.channels[ch_name] if(keyslot1.translate_binary) - src.translate_binary = 1 + src.translate_binary = TRUE if(keyslot1.translate_hive) - src.translate_hive = 1 + src.translate_hive = TRUE if(keyslot1.syndie) - src.syndie = 1 + src.syndie = TRUE if(keyslot2) for(var/ch_name in keyslot2.channels) @@ -170,29 +176,32 @@ src.channels[ch_name] = keyslot2.channels[ch_name] if(keyslot2.translate_binary) - src.translate_binary = 1 + src.translate_binary = TRUE if(keyslot2.translate_hive) - src.translate_hive = 1 + src.translate_hive = TRUE if(keyslot2.syndie) - src.syndie = 1 + src.syndie = TRUE + handle_finalize_recalculatechannels(setDescription, TRUE) + +/obj/item/radio/headset/proc/handle_finalize_recalculatechannels(var/setDescription = FALSE, var/initial_run = FALSE) + PRIVATE_PROC(TRUE) + SHOULD_NOT_OVERRIDE(TRUE) + if(!radio_controller && initial_run) + addtimer(CALLBACK(src,PROC_REF(handle_finalize_recalculatechannels),setDescription, FALSE),3 SECONDS) + return + if(!radio_controller && !initial_run) + name = "broken radio headset" + return for (var/ch_name in channels) - 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] = radio_controller.add_object(src, radiochannels[ch_name], RADIO_CHAT) if(setDescription) setupRadioDescription() - return - /obj/item/radio/headset/proc/setupRadioDescription() var/radio_text = "" for(var/i = 1 to channels.len) diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 86a3cc5a138..4d1040acbf0 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -1,12 +1,12 @@ /obj/item/radio/intercom name = "station intercom (General)" desc = "Talk through this." - icon = 'icons/obj/radio_vr.dmi' //VOREStation Edit - New Icon + icon = 'icons/obj/radio_vr.dmi' icon_state = "intercom" layer = ABOVE_WINDOW_LAYER anchored = TRUE w_class = ITEMSIZE_LARGE - canhear_range = 7 //VOREStation Edit + canhear_range = 7 flags = NOBLOODY light_color = "#00ff00" light_power = 0.25 @@ -14,7 +14,7 @@ vis_flags = VIS_HIDE // They have an emissive that looks bad in openspace due to their wall-mounted nature var/circuit = /obj/item/circuitboard/intercom var/number = 0 - var/wiresexposed = 0 + var/wiresexposed = FALSE /obj/item/radio/intercom/Initialize() . = ..() @@ -33,8 +33,8 @@ /obj/item/radio/intercom/custom name = "station intercom (Custom)" - broadcasting = 0 - listening = 0 + broadcasting = FALSE + listening = FALSE /obj/item/radio/intercom/interrogation name = "station intercom (Interrogation)" @@ -47,13 +47,13 @@ /obj/item/radio/intercom/specops name = "\improper Spec Ops intercom" frequency = ERT_FREQ - subspace_transmission = 1 - centComm = 1 + subspace_transmission = TRUE + centComm = TRUE /obj/item/radio/intercom/department canhear_range = 5 - broadcasting = 0 - listening = 1 + broadcasting = FALSE + listening = TRUE /obj/item/radio/intercom/department/medbay name = "station intercom (Medbay)" @@ -74,26 +74,26 @@ /obj/item/radio/intercom/omni name = "global announcer" /obj/item/radio/intercom/omni/Initialize() + . = ..() channels = radiochannels.Copy() - return ..() -/obj/item/radio/intercom/New() - ..() +/obj/item/radio/intercom/Initialize() + . = ..() circuit = new circuit(src) -/obj/item/radio/intercom/department/medbay/New() - ..() +/obj/item/radio/intercom/department/medbay/Initialize() + . = ..() internal_channels = default_medbay_channels.Copy() -/obj/item/radio/intercom/department/security/New() - ..() +/obj/item/radio/intercom/department/security/Initialize() + . = ..() internal_channels = list( num2text(PUB_FREQ) = list(), num2text(SEC_I_FREQ) = list(access_security) ) -/obj/item/radio/intercom/entertainment/New() - ..() +/obj/item/radio/intercom/entertainment/Initialize() + . = ..() internal_channels = list( num2text(PUB_FREQ) = list(), num2text(ENT_FREQ) = list() @@ -103,22 +103,22 @@ name = "illicit intercom" desc = "Talk through this. Evilly" frequency = SYND_FREQ - subspace_transmission = 1 - syndie = 1 + subspace_transmission = TRUE + syndie = TRUE -/obj/item/radio/intercom/syndicate/New() - ..() +/obj/item/radio/intercom/syndicate/Initialize() + . = ..() internal_channels[num2text(SYND_FREQ)] = list(access_syndicate) /obj/item/radio/intercom/raider name = "illicit intercom" desc = "Pirate radio, but not in the usual sense of the word." frequency = RAID_FREQ - subspace_transmission = 1 - syndie = 1 + subspace_transmission = TRUE + syndie = TRUE -/obj/item/radio/intercom/raider/New() - ..() +/obj/item/radio/intercom/raider/Initialize() + . = ..() internal_channels[num2text(RAID_FREQ)] = list(access_syndicate) /obj/item/radio/intercom/attack_ai(mob/user as mob) @@ -223,8 +223,8 @@ /obj/item/radio/intercom/locked/ai_private name = "\improper AI intercom" frequency = AI_FREQ - broadcasting = 1 - listening = 1 + broadcasting = TRUE + listening = TRUE /obj/item/radio/intercom/locked/confessional name = "confessional intercom" diff --git a/code/game/objects/items/devices/radio/jammer.dm b/code/game/objects/items/devices/radio/jammer.dm index 0847ae66b5d..35760d26d3a 100644 --- a/code/game/objects/items/devices/radio/jammer.dm +++ b/code/game/objects/items/devices/radio/jammer.dm @@ -34,9 +34,11 @@ var/global/list/active_radio_jammers = list() pickup_sound = 'sound/items/pickup/device.ogg' drop_sound = 'sound/items/drop/device.ogg' -/obj/item/radio_jammer/New() +/obj/item/radio_jammer/Initialize() + ..() power_source = new(src) update_icon() // So it starts with the full overlay. + return INITIALIZE_HINT_LATELOAD /obj/item/radio_jammer/Destroy() if(on) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 6c1aeee3b32..c4201e028c1 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -25,8 +25,8 @@ var/global/list/default_medbay_channels = list( //VOREStation Edit End /obj/item/radio - icon = 'icons/obj/radio_vr.dmi' //VOREStation Edit - name = "shortwave radio" //VOREStation Edit + icon = 'icons/obj/radio_vr.dmi' + name = "shortwave radio" desc = "Used to talk to people when headsets don't function. Range is limited." suffix = "\[3\]" icon_state = "walkietalkie" @@ -40,19 +40,19 @@ var/global/list/default_medbay_channels = list( var/loudspeaker = TRUE // Allows borgs to disable canhear_range. var/datum/wires/radio/wires = null var/b_stat = 0 - var/broadcasting = 0 - var/listening = 1 + var/broadcasting = FALSE + var/listening = TRUE var/list/channels = list() //see communications.dm for full list. First channel is a "default" for :h - var/subspace_transmission = 0 + var/subspace_transmission = FALSE var/subspace_switchable = FALSE var/adhoc_fallback = FALSE //Falls back to 'radio' mode if subspace not available - var/syndie = 0//Holder to see if it's a syndicate encrypted radio - var/centComm = 0//Holder to see if it's a CentCom encrypted radio + var/syndie = FALSE//Holder to see if it's a syndicate encrypted radio + var/centComm = FALSE//Holder to see if it's a CentCom encrypted radio slot_flags = SLOT_BELT throw_speed = 2 throw_range = 9 w_class = ITEMSIZE_SMALL - show_messages = 1 + show_messages = TRUE // Bluespace radios talk directly to telecomms equipment var/bluespace_radio = FALSE @@ -73,23 +73,6 @@ var/global/list/default_medbay_channels = list( frequency = new_frequency radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT) -/obj/item/radio/New() - ..() - wires = new(src) - internal_channels = default_internal_channels.Copy() - listening_objects += src - -/obj/item/radio/Destroy() - qdel(wires) - wires = null - listening_objects -= src - if(radio_controller) - radio_controller.remove_object(src, frequency) - for (var/ch_name in channels) - radio_controller.remove_object(src, radiochannels[ch_name]) - return ..() - - /obj/item/radio/Initialize() . = ..() if(frequency < RADIO_LOW_FREQ || frequency > RADIO_HIGH_FREQ) @@ -135,6 +118,21 @@ var/global/list/default_medbay_channels = list( if(!found) testing("A radio [src] at [x],[y],[z] specified bluespace prelink IDs, but the machines with corresponding IDs ([bs_tx_preload_id], [bs_rx_preload_id]) couldn't be found.") + wires = new(src) + internal_channels = default_internal_channels.Copy() + listening_objects += src + return INITIALIZE_HINT_LATELOAD + +/obj/item/radio/Destroy() + qdel(wires) + wires = null + listening_objects -= src + if(radio_controller) + radio_controller.remove_object(src, frequency) + for (var/ch_name in channels) + radio_controller.remove_object(src, radiochannels[ch_name]) + return ..() + /obj/item/radio/proc/recalculateChannels() return @@ -726,17 +724,21 @@ GLOBAL_DATUM(autospeaker, /mob/living/silicon/ai/announcer) if(keyslot.syndie) src.syndie = 1 - for (var/ch_name in src.channels) - if(!radio_controller) - sleep(30) // Waiting for the radio_controller to be created. - if(!radio_controller) - src.name = "broken radio" - return - - secure_radio_connections[ch_name] = radio_controller.add_object(src, radiochannels[ch_name], RADIO_CHAT) - + controller_check(TRUE) return +/obj/item/radio/borg/proc/controller_check(var/initial_run = FALSE) + PRIVATE_PROC(TRUE) + SHOULD_NOT_OVERRIDE(TRUE) + if(!radio_controller && initial_run) + addtimer(CALLBACK(src,PROC_REF(controller_check), FALSE),3 SECONDS) + return + if(!radio_controller && !initial_run) + name = "broken radio headset" + return + for (var/ch_name in channels) + secure_radio_connections[ch_name] = radio_controller.add_object(src, radiochannels[ch_name], RADIO_CHAT) + /obj/item/radio/proc/config(op) if(radio_controller) for (var/ch_name in channels) @@ -762,6 +764,6 @@ GLOBAL_DATUM(autospeaker, /mob/living/silicon/ai/announcer) /obj/item/radio/phone/medbay frequency = MED_I_FREQ -/obj/item/radio/phone/medbay/New() - ..() +/obj/item/radio/phone/medbay/Initialize() + . = ..() internal_channels = default_medbay_channels.Copy() diff --git a/code/game/objects/items/devices/radio/radio_vr.dm b/code/game/objects/items/devices/radio/radio_vr.dm index 7a95741a71f..8801d779fa1 100644 --- a/code/game/objects/items/devices/radio/radio_vr.dm +++ b/code/game/objects/items/devices/radio/radio_vr.dm @@ -1,5 +1,5 @@ /obj/item/radio/phone - subspace_transmission = 1 + subspace_transmission = TRUE canhear_range = 0 adhoc_fallback = TRUE @@ -7,11 +7,11 @@ name = "Medbay Emergency Radio Link" icon_state = "med_walkietalkie" frequency = MED_I_FREQ - subspace_transmission = 1 + subspace_transmission = TRUE adhoc_fallback = TRUE -/obj/item/radio/emergency/New() - ..() +/obj/item/radio/emergency/Initialize() + . = ..() internal_channels = default_medbay_channels.Copy() @@ -30,4 +30,4 @@ /obj/item/radio/bluespacehandset/linked/talon_prelinked bs_tx_preload_id = "talon_aio" //Transmit to a receiver - bs_rx_preload_id = "talon_aio" //Recveive from a transmitter \ No newline at end of file + bs_rx_preload_id = "talon_aio" //Recveive from a transmitter diff --git a/code/game/objects/items/devices/uplink.dm b/code/game/objects/items/devices/uplink.dm index 34b18d7b958..486734673b3 100644 --- a/code/game/objects/items/devices/uplink.dm +++ b/code/game/objects/items/devices/uplink.dm @@ -217,7 +217,7 @@ // // Includes normal radio uplink, multitool uplink, // implant uplink (not the implant tool) and a preset headset uplink. -/obj/item/radio/uplink/New() +/obj/item/radio/uplink/Initialize() ..() hidden_uplink = new(src) icon_state = "radio" @@ -237,6 +237,6 @@ /obj/item/radio/headset/uplink traitor_frequency = 1445 -/obj/item/radio/headset/uplink/New() - ..() +/obj/item/radio/headset/uplink/Initialize() + . = ..() hidden_uplink = new(src) diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/catslug.dm b/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/catslug.dm index 145a65179ba..b07aefd2c23 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/catslug.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/alien animals/catslug.dm @@ -58,16 +58,17 @@ var/obj/item/clothing/head/hat = null // Scughat. var/can_wear_hat = TRUE // Some have inbuilt hats - var/picked_color = FALSE - allow_mind_transfer = TRUE + var/picked_color = FALSE //This needs to be moved to simple_mob. Out of scope for this PR. + can_enter_vent_with = list( /obj/item/implant, /obj/item/radio/borg, /obj/item/holder, /obj/machinery/camera, /obj/belly, + //obj/soulgem, // Used downstream. /obj/screen, /atom/movable/emissive_blocker, /obj/item/material, @@ -138,7 +139,10 @@ belly_attack = FALSE /mob/living/simple_mob/vore/alienanimals/catslug/Initialize() - . = ..() + ..() + return INITIALIZE_HINT_LATELOAD + +/mob/living/simple_mob/vore/alienanimals/catslug/LateInitialize() add_verb(src, /mob/living/proc/ventcrawl) add_verb(src, /mob/living/proc/hide) add_verb(src, /mob/living/simple_mob/vore/alienanimals/catslug/proc/catslug_color) @@ -359,7 +363,9 @@ can_wear_hat = FALSE /mob/living/simple_mob/vore/alienanimals/catslug/custom/Initialize() - . = ..() + ..() + return INITIALIZE_HINT_LATELOAD +/mob/living/simple_mob/vore/alienanimals/catslug/custom/LateInitialize() add_verb(src, /mob/living/proc/ventcrawl) add_verb(src, /mob/living/proc/hide) remove_verb(src, /mob/living/simple_mob/vore/alienanimals/catslug/proc/catslug_color) //Most of these have custom sprites with colour already, so we'll not let them have this. @@ -765,12 +771,15 @@ item_state = "capslug" /mob/living/simple_mob/vore/alienanimals/catslug/custom/capslug/Initialize() //This is such an awful proc, but if someone wants it better they're welcome to have a go at it. - . = ..() + ..() + return INITIALIZE_HINT_LATELOAD + +/mob/living/simple_mob/vore/alienanimals/catslug/custom/capslug/LateInitialize() mob_radio = new /obj/item/radio/headset/mob_headset(src) mob_radio.frequency = PUB_FREQ mob_radio.ks2type = /obj/item/encryptionkey/heads/captain //Might not be able to speak, but the catslug can listen. mob_radio.keyslot2 = new /obj/item/encryptionkey/heads/captain(mob_radio) - mob_radio.recalculateChannels(1) + mob_radio.recalculateChannels(TRUE) //============================================================================= //Admin-spawn only catslugs below - Expect overpowered things & silliness below @@ -809,7 +818,10 @@ player_msg = "You work in the service of corporate Asset Protection, answering directly to the Board of Directors and Asset Protection Commandos." /mob/living/simple_mob/vore/alienanimals/catslug/custom/spaceslug/deathslug/Initialize() - . = ..() + ..() + return INITIALIZE_HINT_LATELOAD + +/mob/living/simple_mob/vore/alienanimals/catslug/custom/spaceslug/deathslug/LateInitialize() mob_radio = new /obj/item/radio/headset/mob_headset(src) mob_radio.frequency = DTH_FREQ //Can't tell if bugged, deathsquad freq in general seems broken myid.access |= get_all_station_access() @@ -850,13 +862,16 @@ player_msg = "You are in the employ of a criminal syndicate hostile to corporate interests. Follow the Mercenary or Commando's orders and assist them in their goals by any means available." /mob/living/simple_mob/vore/alienanimals/catslug/custom/spaceslug/syndislug/Initialize() - . = ..() + ..() + return INITIALIZE_HINT_LATELOAD + +/mob/living/simple_mob/vore/alienanimals/catslug/custom/spaceslug/syndislug/LateInitialize() mob_radio = new /obj/item/radio/headset/mob_headset(src) mob_radio.frequency = SYND_FREQ - mob_radio.syndie = 1 + mob_radio.syndie = TRUE mob_radio.ks2type = /obj/item/encryptionkey/syndicate mob_radio.keyslot2 = new /obj/item/encryptionkey/syndicate(mob_radio) - mob_radio.recalculateChannels(1) + mob_radio.recalculateChannels(TRUE) myid.access |= get_all_station_access() //ERT catslug @@ -894,13 +909,16 @@ Think through your actions and make the roleplay immersive! Please remember all rules aside from those without explicit exceptions apply to the ERT." /mob/living/simple_mob/vore/alienanimals/catslug/custom/spaceslug/responseslug/Initialize() - . = ..() + ..() + return INITIALIZE_HINT_LATELOAD + +/mob/living/simple_mob/vore/alienanimals/catslug/custom/spaceslug/responseslug/LateInitialize() mob_radio = new /obj/item/radio/headset/mob_headset(src) mob_radio.frequency = ERT_FREQ mob_radio.centComm = 1 mob_radio.ks2type = /obj/item/encryptionkey/ert mob_radio.keyslot2 = new /obj/item/encryptionkey/ert(mob_radio) - mob_radio.recalculateChannels(1) + mob_radio.recalculateChannels(TRUE) myid.access |= get_all_station_access() //Pilot Catslug @@ -916,7 +934,10 @@ can_wear_hat = TRUE /mob/living/simple_mob/vore/alienanimals/catslug/custom/pilotslug/Initialize() - . = ..() + ..() + return INITIALIZE_HINT_LATELOAD + +/mob/living/simple_mob/vore/alienanimals/catslug/custom/pilotslug/LateInitialize() if(prob(25)) var/list/possible_targets = list() for(var/obj/machinery/computer/ship/helm/h in world) @@ -1117,6 +1138,9 @@ /mob/living/simple_mob/vore/alienanimals/catslug/suslug/Initialize() . = ..() + return INITIALIZE_HINT_LATELOAD + +/mob/living/simple_mob/vore/alienanimals/catslug/suslug/LateInitialize() add_verb(src, /mob/living/simple_mob/vore/alienanimals/catslug/suslug/proc/assussinate) update_icon() diff --git a/code/modules/pda/radio.dm b/code/modules/pda/radio.dm index 48a05351e18..b3d00a7a8c1 100644 --- a/code/modules/pda/radio.dm +++ b/code/modules/pda/radio.dm @@ -17,13 +17,15 @@ on = 0 //Are we currently active?? var/menu_message = "" -/obj/item/radio/integrated/New() +/obj/item/radio/integrated/Initialize() ..() if(istype(loc.loc, /obj/item/pda)) hostpda = loc.loc + return INITIALIZE_HINT_LATELOAD + +/obj/item/radio/integrated/LateInitialize() if(bot_filter) - spawn(5) - add_to_radio(bot_filter) + add_to_radio(bot_filter) /obj/item/radio/integrated/Destroy() if(radio_controller)