Merge pull request #3505 from Zuhayr/master

Language cleanup/mouse speech fix.
This commit is contained in:
Chinsky
2013-08-13 16:48:45 -07:00
10 changed files with 104 additions and 71 deletions

View File

@@ -863,19 +863,23 @@ datum/preferences
s_tone = 0
if("language")
var/languages_available
var/list/new_languages = list("None")
var/language_whitelisted = 0
if(config.usealienwhitelist)
for(var/L in all_languages)
if(is_alien_whitelisted(user, L))
new_languages += L
language_whitelisted = 1
var/datum/language/lang = all_languages[L]
if((!(lang.flags & RESTRICTED)) && (is_alien_whitelisted(user, L)||(!( lang.flags & WHITELISTED ))))
new_languages += lang
languages_available = 1
if(!(languages_available))
alert(user, "There are not currently any available secondary languages.")
else
for(var/L in all_languages)
new_languages += L
if(!language_whitelisted)
alert(user, "You cannot select a secondary language as you need to be whitelisted. If you wish to enable a language, post in the Alien Whitelist forums.")
var/datum/language/lang = all_languages[L]
if(!(lang.flags & RESTRICTED))
new_languages += lang
language = input("Please select a secondary language", "Character Generation", null) in new_languages

View File

@@ -3,35 +3,66 @@
*/
/datum/language
var/name = "name" // Fluff name of language if any.
var/speech_verb // 'says', 'hisses', 'farts'.
var/colour // CSS style to use for strings in this language.
var/key // Character used to speak in language eg. :o for Unathi.
var/name = "an unknown language" // Fluff name of language if any.
var/desc = "A language." // Short description for 'Check Languages'.
var/speech_verb = "says" // 'says', 'hisses', 'farts'.
var/colour = "say_quote" // CSS style to use for strings in this language.
var/key = "x" // Character used to speak in language eg. :o for Unathi.
var/flags = 0 // Various language flags.
var/native // If set, non-native speakers will have trouble speaking.
/datum/language/unathi
name = "Sinta'unathi"
desc = "The common language of Moghes, composed of sibilant hisses and rattles. Spoken natively by Unathi."
speech_verb = "hisses"
colour = "soghun"
key = "o"
flags = WHITELISTED
/datum/language/tajaran
name = "Siik'mas"
name = "Siik'tajr"
desc = "An expressive language that combines yowls and chirps with posture, tail and ears. Native to the Tajaran."
speech_verb = "mrowls"
colour = "tajaran"
key = "j"
flags = WHITELISTED
/datum/language/skrell
name = "Skrellian"
desc = "A melodic and complex language spoken by the Skrell of Qerrbalak. Some of the notes are inaudible to humans."
speech_verb = "warbles"
colour = "skrell"
key = "k"
flags = WHITELISTED
/datum/language/vox
name = "Vox-pidgin"
desc = "The common tongue of the various Vox ships making up the Shoal. It sounds like chaotic shrieking to everyone else."
speech_verb = "shrieks"
colour = "vox"
key = "v"
flags = RESTRICTED
/*
/datum/language/human
name = "Sol Common"
desc = "A bastardized hybrid of informal English and elements of Mandarin Chinese; the common language of the Sol system."
key = "hum"
flags = RESTRICTED
// Galactic common languages (systemwide accepted standards).
/datum/language/trader
name = "Tradeband"
desc = "Maintained by the various trading cartels in major systems, this elegant, structured language is used for bartering and bargaining."
speech_verb = "enunciates"
key = "tra"
/datum/language/gutter
name = "Gutter"
desc = "Much like Standard, this crude pidgin tongue descended from numerous languages and serves as Tradeband for criminal elements."
speech_verb = "growls"
key = "gut"
*/
// Language handling.
/mob/proc/add_language(var/language)

View File

@@ -105,7 +105,10 @@
message = slur(message)
..(message)
/mob/living/carbon/human/say_understands(var/other)
/mob/living/carbon/human/say_understands(var/other,var/datum/language/speaking = null)
if(has_brain_worms()) //Brain worms translate everything. Even mice and alien speak.
return 1
if (istype(other, /mob/living/silicon/ai))
return 1
if (istype(other, /mob/living/silicon/decoy))

View File

@@ -58,7 +58,7 @@
name = "Tajaran"
icobase = 'icons/mob/human_races/r_tajaran.dmi'
deform = 'icons/mob/human_races/r_def_tajaran.dmi'
language = "Siik'mas"
language = "Siik'tajr"
tail = "tajtail"
attack_verb = "scratch"
darksight = 8

View File

@@ -86,7 +86,6 @@ var/list/department_radio_keys = list(
/mob/living/say(var/message)
//world << "[src] speaks! [message]"
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = capitalize(message)
@@ -125,7 +124,7 @@ var/list/department_radio_keys = list(
var/italics = 0
var/message_range = null
var/message_mode = null
var/datum/language/speaking //For use if a specific language is being spoken.
var/datum/language/speaking = null //For use if a specific language is being spoken.
// If brain damaged, talk on headset at random.
if (getBrainLoss() >= 60 && prob(50))
@@ -146,11 +145,9 @@ var/list/department_radio_keys = list(
//Check if the person is speaking a language that they know.
for(var/datum/language/L in languages)
if(lowertext(channel_prefix) == ":[L.key]")
//world << "Key [L.key] matches [lowertext(channel_prefix)] for [src]."
speaking = L
break
message_mode = department_radio_keys[channel_prefix]
//world << "channel_prefix=[channel_prefix]; message_mode=[message_mode]"
if (message_mode)
message = trim(copytext(message, 3))
if (!(ishuman(src) || istype(src, /mob/living/simple_animal/parrot) || isrobot(src) && (message_mode=="department" || (message_mode in radiochannels))))
@@ -367,38 +364,12 @@ var/list/department_radio_keys = list(
for (var/M in listening)
if(hascall(M,"say_understands"))
if ((M:say_understands(src) && !speaking))
//world << "[M] understood [src] (0)."
if (M:say_understands(src,speaking))
heard_a += M
else if(ismob(M))
// If speaking is set, it means that a language has been found that uses the given key.
// If it hasn't, then they are likely just speaking English.
var/understood
var/mob/P = M
if (speaking)
for(var/datum/language/L in P.languages)
if(speaking.name == L.name)
understood = 1
if(understood || P.universal_speak)
//world << "[M] understood [src] (1)."
heard_a += M
else if(istype(P,/mob/living/carbon/human))
var/mob/living/carbon/human/H = P
if(H.has_brain_worms()) // Brain worms act like Babelfish.
heard_a += M
else
heard_b += M
else
//world << "[M] didn't understand [src]."
heard_b += M
else
heard_a += M
else
//world << "[M] understood [src] (2)."
heard_a += M
heard_b += M
else
heard_a += M
var/speech_bubble_test = say_test(message)
var/image/speech_bubble = image('icons/mob/talk.dmi',src,"h[speech_bubble_test]")

View File

@@ -360,7 +360,7 @@
if(client.prefs.language)
chosen_language = all_languages[client.prefs.language]
if(chosen_language)
if(is_alien_whitelisted(src, client.prefs.language) || !config.usealienwhitelist)
if(is_alien_whitelisted(src, client.prefs.language) || !config.usealienwhitelist || !(chosen_language.flags & WHITELISTED))
new_character.add_language(client.prefs.language)
if(ticker.random_players)

View File

@@ -61,17 +61,30 @@
M.show_message(rendered, 2) //Takes into account blindness and such.
return
/mob/proc/say_understands(var/mob/other)
/mob/proc/say_understands(var/mob/other,var/datum/language/speaking = null)
if(!other)
return 1
if (src.stat == 2)
return 1
else if (istype(other, src.type))
else if (src.stat == 2)
return 1
else if (speaking) //Language check.
var/understood
for(var/datum/language/L in src.languages)
if(speaking.name == L.name)
understood = 1
break
if(understood || universal_speak)
return 1
else
return 0
else if(other.universal_speak || src.universal_speak)
return 1
else if(isAI(src) && ispAI(other))
return 1
else if (istype(other, src.type))
return 1
return 0
/mob/proc/say_quote(var/text,var/datum/language/speaking)
@@ -80,26 +93,28 @@
//tcomms code is still runtiming somewhere here
var/ending = copytext(text, length(text))
if (speaking)
return "<span class='say_quote'>[speaking.speech_verb]</span>, \"<span class='[speaking.colour]'>[text]</span>\"";
var/speechverb = "<span class='say_quote'>"
//Needs Virus2
// if (src.disease_symptoms & DISEASE_HOARSE)
// return "rasps, \"[text]\"";
if (src.stuttering)
return "<span class='say_quote'>stammers</span>, \"[text]\"";
if (src.slurring)
return "<span class='say_quote'>slurrs</span>, \"[text]\"";
if(isliving(src))
if (speaking)
speechverb = "[speaking.speech_verb]</span>, \"<span class='[speaking.colour]'>"
else if (src.stuttering)
speechverb = "stammers, \""
else if (src.slurring)
speechverb = "slurrs, \""
else if (ending == "?")
speechverb = "asks, \""
else if (ending == "!")
speechverb = "exclaims, \""
else if(isliving(src))
var/mob/living/L = src
if (L.getBrainLoss() >= 60)
return "<span class='say_quote'>gibbers</span>, \"[text]\"";
if (ending == "?")
return "<span class='say_quote'>asks</span>, \"[text]\"";
if (ending == "!")
return "<span class='say_quote'>exclaims</span>, \"[text]\"";
speechverb = "gibbers, \""
else
speechverb = "says, \""
else
speechverb = "says, \""
return "<span class='say_quote'>says</span>, \"[text]\"";
return "[speechverb][text]</span>\""
/mob/proc/emote(var/act, var/type, var/message)
if(act == "me")