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

@@ -73,6 +73,11 @@
icon_state = "snowbush[rand(1, 6)]" icon_state = "snowbush[rand(1, 6)]"
..() ..()
/obj/structure/flora/pottedplant
name = "potted plant"
icon = 'icons/obj/plants.dmi'
icon_state = "plant-26"
//newbushes //newbushes
/obj/structure/flora/ausbushes /obj/structure/flora/ausbushes

View File

@@ -863,19 +863,23 @@ datum/preferences
s_tone = 0 s_tone = 0
if("language") if("language")
var/languages_available
var/list/new_languages = list("None") var/list/new_languages = list("None")
var/language_whitelisted = 0
if(config.usealienwhitelist) if(config.usealienwhitelist)
for(var/L in all_languages) for(var/L in all_languages)
if(is_alien_whitelisted(user, L)) var/datum/language/lang = all_languages[L]
new_languages += L if((!(lang.flags & RESTRICTED)) && (is_alien_whitelisted(user, L)||(!( lang.flags & WHITELISTED ))))
language_whitelisted = 1 new_languages += lang
languages_available = 1
if(!(languages_available))
alert(user, "There are not currently any available secondary languages.")
else else
for(var/L in all_languages) for(var/L in all_languages)
new_languages += L var/datum/language/lang = all_languages[L]
if(!(lang.flags & RESTRICTED))
if(!language_whitelisted) new_languages += lang
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.")
language = input("Please select a secondary language", "Character Generation", null) in new_languages language = input("Please select a secondary language", "Character Generation", null) in new_languages

View File

@@ -3,35 +3,66 @@
*/ */
/datum/language /datum/language
var/name = "name" // Fluff name of language if any. var/name = "an unknown language" // Fluff name of language if any.
var/speech_verb // 'says', 'hisses', 'farts'. var/desc = "A language." // Short description for 'Check Languages'.
var/colour // CSS style to use for strings in this language. var/speech_verb = "says" // 'says', 'hisses', 'farts'.
var/key // Character used to speak in language eg. :o for Unathi. 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 /datum/language/unathi
name = "Sinta'unathi" name = "Sinta'unathi"
desc = "The common language of Moghes, composed of sibilant hisses and rattles. Spoken natively by Unathi."
speech_verb = "hisses" speech_verb = "hisses"
colour = "soghun" colour = "soghun"
key = "o" key = "o"
flags = WHITELISTED
/datum/language/tajaran /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" speech_verb = "mrowls"
colour = "tajaran" colour = "tajaran"
key = "j" key = "j"
flags = WHITELISTED
/datum/language/skrell /datum/language/skrell
name = "Skrellian" 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" speech_verb = "warbles"
colour = "skrell" colour = "skrell"
key = "k" key = "k"
flags = WHITELISTED
/datum/language/vox /datum/language/vox
name = "Vox-pidgin" 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" speech_verb = "shrieks"
colour = "vox" colour = "vox"
key = "v" 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. // Language handling.
/mob/proc/add_language(var/language) /mob/proc/add_language(var/language)

View File

@@ -105,7 +105,10 @@
message = slur(message) message = slur(message)
..(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)) if (istype(other, /mob/living/silicon/ai))
return 1 return 1
if (istype(other, /mob/living/silicon/decoy)) if (istype(other, /mob/living/silicon/decoy))

View File

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

View File

@@ -86,7 +86,6 @@ var/list/department_radio_keys = list(
/mob/living/say(var/message) /mob/living/say(var/message)
//world << "[src] speaks! [message]"
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)) message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
message = capitalize(message) message = capitalize(message)
@@ -125,7 +124,7 @@ var/list/department_radio_keys = list(
var/italics = 0 var/italics = 0
var/message_range = null var/message_range = null
var/message_mode = 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 brain damaged, talk on headset at random.
if (getBrainLoss() >= 60 && prob(50)) 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. //Check if the person is speaking a language that they know.
for(var/datum/language/L in languages) for(var/datum/language/L in languages)
if(lowertext(channel_prefix) == ":[L.key]") if(lowertext(channel_prefix) == ":[L.key]")
//world << "Key [L.key] matches [lowertext(channel_prefix)] for [src]."
speaking = L speaking = L
break break
message_mode = department_radio_keys[channel_prefix] message_mode = department_radio_keys[channel_prefix]
//world << "channel_prefix=[channel_prefix]; message_mode=[message_mode]"
if (message_mode) if (message_mode)
message = trim(copytext(message, 3)) message = trim(copytext(message, 3))
if (!(ishuman(src) || istype(src, /mob/living/simple_animal/parrot) || isrobot(src) && (message_mode=="department" || (message_mode in radiochannels)))) 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) for (var/M in listening)
if(hascall(M,"say_understands")) if(hascall(M,"say_understands"))
if ((M:say_understands(src) && !speaking)) if (M:say_understands(src,speaking))
//world << "[M] understood [src] (0)."
heard_a += M 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 else
//world << "[M] understood [src] (2)." heard_b += M
heard_a += M else
heard_a += M
var/speech_bubble_test = say_test(message) var/speech_bubble_test = say_test(message)
var/image/speech_bubble = image('icons/mob/talk.dmi',src,"h[speech_bubble_test]") var/image/speech_bubble = image('icons/mob/talk.dmi',src,"h[speech_bubble_test]")

View File

@@ -360,7 +360,7 @@
if(client.prefs.language) if(client.prefs.language)
chosen_language = all_languages[client.prefs.language] chosen_language = all_languages[client.prefs.language]
if(chosen_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) new_character.add_language(client.prefs.language)
if(ticker.random_players) if(ticker.random_players)

View File

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

View File

@@ -719,3 +719,7 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
#define HAS_UNDERWEAR 1024 #define HAS_UNDERWEAR 1024
#define HAS_TAIL 2048 #define HAS_TAIL 2048
#define IS_PLANT 4096 #define IS_PLANT 4096
//Language flags.
#define WHITELISTED 1 // Language is available if the speaker is whitelisted.
#define RESTRICTED 2 // Language can only be accquired by spawning or an admin.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 22 KiB