From 4615af69275d303a1e55fa74b057fbee2b92b53f Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Mon, 2 Dec 2019 08:06:45 +0100 Subject: [PATCH] Can't speak in radios while cuffed + no more radio icons in messages (#7431) Can't speak in radios while cuffed + no more radio icons in messages --- code/game/machinery/telecomms/broadcaster.dm | 4 +- .../game/objects/items/devices/radio/radio.dm | 25 ++--- code/modules/mob/living/carbon/human/say.dm | 95 ++++++++++--------- html/changelogs/mattatlas-7431.yml | 42 ++++++++ 4 files changed, 99 insertions(+), 67 deletions(-) create mode 100644 html/changelogs/mattatlas-7431.yml diff --git a/code/game/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm index 7005e4c6946..6fa6eb85a98 100644 --- a/code/game/machinery/telecomms/broadcaster.dm +++ b/code/game/machinery/telecomms/broadcaster.dm @@ -338,7 +338,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept var/part_b_extra = "" if(data == 3) // intercepted radio message part_b_extra = " (Intercepted)" - var/part_a = "\icon[radio]\[[freq_text]\][part_b_extra] " // goes in the actual output + var/part_a = "\[[freq_text]\][part_b_extra] " // goes in the actual output // --- Some more pre-message formatting --- var/part_b = " " // Tweaked for security headsets -- TLE @@ -541,7 +541,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept // Create a radio headset for the sole purpose of using its icon var/static/obj/item/device/radio/headset/radio = new - var/part_b = " \icon[radio]\[[freq_text]\][part_b_extra] " // Tweaked for security headsets -- TLE + var/part_b = " \[[freq_text]\][part_b_extra] " // Tweaked for security headsets -- TLE var/part_blackbox_b = " \[[freq_text]\] " // Tweaked for security headsets -- TLE var/part_c = "" diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 9b5fbfc677a..55c65dd4b31 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -268,12 +268,15 @@ var/global/list/default_medbay_channels = list( // If we were to send to a channel we don't have, drop it. return null -/obj/item/device/radio/talk_into(mob/living/M as mob, message, channel, var/verb = "says", var/datum/language/speaking = null) - if(!on) return 0 // the device has to be on +/obj/item/device/radio/talk_into(mob/living/M, message, channel, var/verb = "says", var/datum/language/speaking = null) + if(!on) + return 0 // the device has to be on // Fix for permacell radios, but kinda eh about actually fixing them. - if(!M || !message) return 0 + if(!M || !message) + return 0 - if(istype(M)) M.trigger_aiming(TARGET_CAN_RADIO) + if(istype(M)) + M.trigger_aiming(TARGET_CAN_RADIO) // Uncommenting this. To the above comment: // The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom @@ -477,20 +480,6 @@ var/global/list/default_medbay_channels = list( if(get_dist(src, M) <= canhear_range) talk_into(M, msg,null,verb,speaking) - -/* -/obj/item/device/radio/proc/accept_rad(obj/item/device/radio/R as obj, message) - - if ((R.frequency == frequency && message)) - return 1 - else if - - else - return null - return -*/ - - /obj/item/device/radio/proc/receive_range(freq, level) // check if this radio can receive on the given frequency, and if so, // what the range is in which mobs will hear the radio diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm index 9cfbc0e3525..6cc6798532e 100644 --- a/code/modules/mob/living/carbon/human/say.dm +++ b/code/modules/mob/living/carbon/human/say.dm @@ -167,57 +167,58 @@ return returns /mob/living/carbon/human/handle_message_mode(message_mode, message, verb, speaking, used_radios, alt_name) - switch(message_mode) - if("intercom") - if(!src.restrained()) - for(var/obj/item/device/radio/intercom/I in view(1)) - I.talk_into(src, message, null, verb, speaking) - I.add_fingerprint(src) - used_radios += I - if("headset") - if(l_ear && istype(l_ear,/obj/item/device/radio)) - var/obj/item/device/radio/R = l_ear - R.talk_into(src,message,null,verb,speaking) - used_radios += l_ear - else if(r_ear && istype(r_ear,/obj/item/device/radio)) - var/obj/item/device/radio/R = r_ear - R.talk_into(src,message,null,verb,speaking) - used_radios += r_ear - if("right ear") - var/obj/item/device/radio/R - var/has_radio = 0 - if(r_ear && istype(r_ear,/obj/item/device/radio)) - R = r_ear - has_radio = 1 - if(r_hand && istype(r_hand, /obj/item/device/radio)) - R = r_hand - has_radio = 1 - if(has_radio) - R.talk_into(src,message,null,verb,speaking) - used_radios += R - if("left ear") - var/obj/item/device/radio/R - var/has_radio = 0 - if(l_ear && istype(l_ear,/obj/item/device/radio)) - R = l_ear - has_radio = 1 - if(l_hand && istype(l_hand,/obj/item/device/radio)) - R = l_hand - has_radio = 1 - if(has_radio) - R.talk_into(src,message,null,verb,speaking) - used_radios += R - if("whisper") - whisper_say(message, speaking, alt_name) - return 1 - else - if(message_mode) + if(!restrained()) + switch(message_mode) + if("intercom") + if(!src.restrained()) + for(var/obj/item/device/radio/intercom/I in view(1)) + I.talk_into(src, message, null, verb, speaking) + I.add_fingerprint(src) + used_radios += I + if("headset") if(l_ear && istype(l_ear,/obj/item/device/radio)) - l_ear.talk_into(src,message, message_mode, verb, speaking) + var/obj/item/device/radio/R = l_ear + R.talk_into(src,message,null,verb,speaking) used_radios += l_ear else if(r_ear && istype(r_ear,/obj/item/device/radio)) - r_ear.talk_into(src,message, message_mode, verb, speaking) + var/obj/item/device/radio/R = r_ear + R.talk_into(src,message,null,verb,speaking) used_radios += r_ear + if("right ear") + var/obj/item/device/radio/R + var/has_radio = 0 + if(r_ear && istype(r_ear,/obj/item/device/radio)) + R = r_ear + has_radio = 1 + if(r_hand && istype(r_hand, /obj/item/device/radio)) + R = r_hand + has_radio = 1 + if(has_radio) + R.talk_into(src,message,null,verb,speaking) + used_radios += R + if("left ear") + var/obj/item/device/radio/R + var/has_radio = 0 + if(l_ear && istype(l_ear,/obj/item/device/radio)) + R = l_ear + has_radio = 1 + if(l_hand && istype(l_hand,/obj/item/device/radio)) + R = l_hand + has_radio = 1 + if(has_radio) + R.talk_into(src,message,null,verb,speaking) + used_radios += R + if("whisper") + whisper_say(message, speaking, alt_name) + return 1 + else + if(message_mode) + if(l_ear && istype(l_ear,/obj/item/device/radio)) + l_ear.talk_into(src,message, message_mode, verb, speaking) + used_radios += l_ear + else if(r_ear && istype(r_ear,/obj/item/device/radio)) + r_ear.talk_into(src,message, message_mode, verb, speaking) + used_radios += r_ear /mob/living/carbon/human/handle_speech_sound() var/list/returns = ..() diff --git a/html/changelogs/mattatlas-7431.yml b/html/changelogs/mattatlas-7431.yml new file mode 100644 index 00000000000..62a0862a9b6 --- /dev/null +++ b/html/changelogs/mattatlas-7431.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "You can no longer speak into a radio while restrained." + - tweak: "The icon of the device you're using to speak into a radio is no longer shown in a message."