Saycode refactor/improvements

- Refactored multiple bits of saycode to be less eyeburning code
 - Radios now properly report special channel messages (binary, hivemind)
 - Animals with no speak list no longer show unfiltered messages to
   everyone.

 - Fun part:
   - Improves handling of headsets for the two ear system.
     - The right headset will now be talked into if the left headset
       reports that it is unable to send the message on the chosen
       channel/mode.
     - This means that instead of having to swap headsets around, wearing
       a headset on either ear will grant you access to all of it's
       channels.
     - The left headset will take priority, which really only affects when
       it's set to a non-standard frequency.
This commit is contained in:
Tigercat2000
2016-07-18 19:17:11 -07:00
parent a28ae804b9
commit 9f8ba253c9
12 changed files with 174 additions and 160 deletions
@@ -55,10 +55,12 @@
if(translate_binary)
var/datum/language/binary = all_languages["Robot Talk"]
binary.broadcast(M, message)
return RADIO_CONNECTION_NON_SUBSPACE
if(translate_hive)
var/datum/language/hivemind = all_languages["Hivemind"]
hivemind.broadcast(M, message)
return null
return RADIO_CONNECTION_NON_SUBSPACE
return RADIO_CONNECTION_FAIL
return ..()
+14 -7
View File
@@ -295,12 +295,14 @@ var/global/list/default_medbay_channels = list(
return secure_radio_connections[message_mode]
// If we were to send to a channel we don't have, drop it.
return null
return RADIO_CONNECTION_FAIL
/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
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
// 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
@@ -322,12 +324,17 @@ var/global/list/default_medbay_channels = list(
*/
//#### Grab the connection datum ####//
var/datum/radio_frequency/connection = handle_message_mode(M, message, channel)
if(!istype(connection))
return 0
if(!connection)
var/message_mode = handle_message_mode(M, message, channel)
switch(message_mode) //special cases
if(RADIO_CONNECTION_FAIL)
return 0
if(RADIO_CONNECTION_NON_SUBSPACE)
return 1
if(!istype(message_mode, /datum/radio_frequency)) //if not a special case, it should be returning a radio connection
return 0
var/datum/radio_frequency/connection = message_mode
var/turf/position = get_turf(src)
//#### Tagging the signal with all appropriate identity values ####//