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
+10 -11
View File
@@ -53,13 +53,12 @@
say_dead_direct("[pick("complains", "moans", "whines", "laments", "blubbers", "salts")], <span class='message'>\"[message]\"</span>", src)
/mob/proc/say_understands(var/mob/other,var/datum/language/speaking = null)
if(src.stat == 2) //Dead
/mob/proc/say_understands(var/mob/other, var/datum/language/speaking = null)
if(stat == DEAD)
return 1
//Universal speak makes everything understandable, for obvious reasons.
else if(src.universal_speak || src.universal_understand)
if(universal_speak || universal_understand)
return 1
//Languages are handled after.
@@ -78,7 +77,7 @@
return 1
//Language check.
for(var/datum/language/L in src.languages)
for(var/datum/language/L in languages)
if(speaking.name == L.name)
return 1
@@ -92,9 +91,9 @@
if(speaking)
verb = speaking.get_spoken_verb(ending)
else
if(ending=="!")
verb = pick("exclaims","shouts","yells")
else if(ending=="?")
if(ending == "!")
verb = pick("exclaims", "shouts", "yells")
else if(ending == "?")
verb = "asks"
return verb
@@ -123,8 +122,8 @@
//parses the message mode code (e.g. :h, :w) from text, such as that supplied to say.
//returns the message mode string or null for no message mode.
//standard mode is the mode returned for the special ';' radio code.
/mob/proc/parse_message_mode(var/message, var/standard_mode="headset")
if(length(message) >= 1 && copytext(message,1,2) == ";")
/mob/proc/parse_message_mode(var/message, var/standard_mode = "headset")
if(length(message) >= 1 && copytext(message, 1, 2) == ";")
return standard_mode
if(length(message) >= 2)
@@ -136,7 +135,7 @@
//parses the language code (e.g. :j) from text, such as that supplied to say.
//returns the language object only if the code corresponds to a language that src can speak, otherwise null.
/mob/proc/parse_language(var/message)
var/prefix = copytext(message,1,2)
var/prefix = copytext(message, 1, 2)
if(length(message) >= 1 && prefix == "!")
return all_languages["Noise"]