From 9a19d319e189523cb7cc8bfb771a0e9d55ab9012 Mon Sep 17 00:00:00 2001 From: AffectedArc07 Date: Sat, 23 May 2020 11:44:14 +0100 Subject: [PATCH] Fox Fixes. Foxes? --- code/game/machinery/tcomms/_base.dm | 38 ++++++++++++++----- code/game/machinery/tcomms/core.dm | 2 + code/game/machinery/tcomms/relay.dm | 9 +++-- .../game/objects/items/devices/radio/radio.dm | 13 ++++++- 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/code/game/machinery/tcomms/_base.dm b/code/game/machinery/tcomms/_base.dm index 7837c4706e6..dccf1b23f28 100644 --- a/code/game/machinery/tcomms/_base.dm +++ b/code/game/machinery/tcomms/_base.dm @@ -74,14 +74,14 @@ GLOBAL_LIST_EMPTY(tcomms_machines) // Attack overrides. These are needed so the UIs can be opened up // -/obj/machinery/tcomms/attack_ai(mob/user as mob) +/obj/machinery/tcomms/attack_ai(mob/user) add_hiddenprint(user) ui_interact(user) -/obj/machinery/tcomms/attack_ghost(mob/user as mob) +/obj/machinery/tcomms/attack_ghost(mob/user) ui_interact(user) -/obj/machinery/tcomms/attack_hand(mob/user as mob) +/obj/machinery/tcomms/attack_hand(mob/user) if(..(user)) return ui_interact(user) @@ -230,7 +230,7 @@ GLOBAL_LIST_EMPTY(tcomms_machines) bad_connection = is_bad_connection(tcm.connection.frequency, display_freq) new_connection = SSradio.return_frequency(display_freq) - var/list/obj/item/radio/radios = list() + var/list/radios = list() // --- Broadcast only to intercom devices --- @@ -282,7 +282,10 @@ GLOBAL_LIST_EMPTY(tcomms_machines) var/list/heard_garbled = list() // garbled message (ie "f*c* **u, **i*er!") var/list/heard_gibberish= list() // completely screwed over message (ie "F%! (O*# *#!<>&**%!") - for(var/mob/R in receive) + for(var/M in receive) + if(!istype(M, /mob)) + return + var/mob/R = M /* --- Loop through the receivers and categorize them --- */ @@ -372,33 +375,48 @@ GLOBAL_LIST_EMPTY(tcomms_machines) /* --- Process all the mobs that heard a masked voice (understood) --- */ if(length(heard_masked)) - for(var/mob/R in heard_masked) + for(var/M in heard_masked) + if(!istype(M, /mob)) + return + var/mob/R = M R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 0, tcm.sender_name, follow_target=tcm.follow_target) /* --- Process all the mobs that heard the voice normally (understood) --- */ if(length(heard_normal)) - for(var/mob/R in heard_normal) + for(var/M in heard_normal) + if(!istype(M, /mob)) + return + var/mob/R = M R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 0, tcm.sender_name, follow_target=tcm.follow_target) /* --- Process all the mobs that heard the voice normally (did not understand) --- */ if(length(heard_voice)) - for(var/mob/R in heard_voice) + for(var/M in heard_voice) + if(!istype(M, /mob)) + return + var/mob/R = M R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender,0, tcm.vname, follow_target=tcm.follow_target) /* --- Process all the mobs that heard a garbled voice (did not understand) --- */ // Displays garbled message (ie "f*c* **u, **i*er!") if(length(heard_garbled)) - for(var/mob/R in heard_garbled) + for(var/M in heard_garbled) + if(!istype(M, /mob)) + return + var/mob/R = M R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 1, tcm.vname, follow_target=tcm.follow_target) /* --- Complete gibberish. Usually happens when there's a compressed message --- */ if(length(heard_gibberish)) - for(var/mob/R in heard_gibberish) + for(var/M in heard_gibberish) + if(!istype(M, /mob)) + return + var/mob/R = M R.hear_radio(tcm.message_pieces, tcm.verbage, part_a, part_b, tcm.sender, 1, follow_target=tcm.follow_target) return TRUE diff --git a/code/game/machinery/tcomms/core.dm b/code/game/machinery/tcomms/core.dm index 5c0d5d33e14..a893501edcb 100644 --- a/code/game/machinery/tcomms/core.dm +++ b/code/game/machinery/tcomms/core.dm @@ -42,6 +42,8 @@ /obj/machinery/tcomms/core/Destroy() for(var/obj/machinery/tcomms/relay/R in linked_relays) R.Reset() + qdel(nttc) // Delete the NTTC datum + linked_relays.Cut() // Just to be sure return ..() /** diff --git a/code/game/machinery/tcomms/relay.dm b/code/game/machinery/tcomms/relay.dm index 66972583fa9..8c2bbf28bf2 100644 --- a/code/game/machinery/tcomms/relay.dm +++ b/code/game/machinery/tcomms/relay.dm @@ -70,10 +70,11 @@ * Resets the relay, removing its linkage status, and refreshing the core's list of z-levels */ /obj/machinery/tcomms/relay/proc/Reset() - linked_core.linked_relays -= src - linked_core.refresh_zlevels() - linked_core = null - linked = FALSE + if(linked_core) + linked_core.linked_relays -= src + linked_core.refresh_zlevels() + linked_core = null + linked = FALSE /** * Relay Enabler diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 0d712c3d021..ffb34100cfb 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -236,7 +236,7 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( add_fingerprint(usr) -/obj/item/radio/proc/autosay(var/message, var/from, var/channel, var/role = "Unknown") //BS12 EDIT +/obj/item/radio/proc/autosay(message, from, channel, role = "Unknown") //BS12 EDIT var/datum/radio_frequency/connection = null if(channel && channels && channels.len > 0) if(channel == "department") @@ -283,6 +283,7 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( // Now put that through the stuff for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines) C.handle_message(tcm) + qdel(tcm) // Delete the message datum qdel(A) // Just a dummy mob used for making announcements, so we don't create AIs to do this @@ -341,7 +342,10 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( var/jammed = FALSE var/turf/position = get_turf(src) - for(var/obj/item/jammer/jammer in GLOB.active_jammers) + for(var/J in GLOB.active_jammers) + if(!istype(J, /obj/item/jammer)) + return + var/obj/item/jammer/jammer = J if(get_dist(position, get_turf(jammer)) < jammer.range) jammed = TRUE break @@ -427,10 +431,13 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines) if(C.handle_message(tcm)) handled = TRUE + qdel(tcm) // Delete the message datum return TRUE // If we dont need tcomms and we have no connection if(!requires_tcomms && !handled) + // If they dont need tcomms for their signal, set the type to intercoms + tcm.data = SIGNALTYPE_INTERCOM_SBR tcm.zlevels = list(position.z) if(!instant) // Simulate two seconds of lag @@ -438,9 +445,11 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( else // Nukeops + Deathsquad headsets are instant and should work the same, whether there is comms or not broadcast_message(tcm) + qdel(tcm) // Delete the message datum return TRUE // If we didnt get here, oh fuck + qdel(tcm) // Delete the message datum return FALSE