mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-05 15:04:21 +00:00
Silicon mob types can now speak languages
This commit is contained in:
@@ -23,6 +23,7 @@ var/global/list/joblist = list() //list of all jobstypes, minus borg and AI
|
||||
//Languages/species/whitelist.
|
||||
var/global/list/all_species[0]
|
||||
var/global/list/all_languages[0]
|
||||
var/global/list/language_keys[0] //table of say codes for all languages
|
||||
var/global/list/whitelisted_species = list("Human")
|
||||
|
||||
// Posters
|
||||
@@ -100,6 +101,9 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al
|
||||
for(var/T in paths)
|
||||
var/datum/language/L = new T
|
||||
all_languages[L.name] = L
|
||||
|
||||
for (var/datum/language/L in all_languages)
|
||||
language_keys[L.key] = L
|
||||
|
||||
var/rkey = 0
|
||||
paths = typesof(/datum/species)-/datum/species
|
||||
|
||||
@@ -90,6 +90,11 @@
|
||||
|
||||
return 0
|
||||
|
||||
// Can we speak this language, as opposed to just understanding it?
|
||||
/mob/proc/can_speak(datum/language/language)
|
||||
|
||||
return (universal_speak || language in src.languages)
|
||||
|
||||
//TBD
|
||||
/mob/verb/check_languages()
|
||||
set name = "Check Known Languages"
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
alt_name = "(as [get_id_name("Unknown")])"
|
||||
|
||||
//parse the radio code and consume it
|
||||
var/message_mode = parse_message_mode(message)
|
||||
var/message_mode = parse_message_mode(message, "headset")
|
||||
if (message_mode)
|
||||
if (message_mode == "headset")
|
||||
message = copytext(message,2)
|
||||
message = copytext(message,2) //it would be really nice if the parse procs could do this for us.
|
||||
else
|
||||
message = copytext(message,3)
|
||||
|
||||
|
||||
@@ -60,27 +60,25 @@
|
||||
return
|
||||
|
||||
var/verb = say_quote(message)
|
||||
var/message_mode = null
|
||||
|
||||
|
||||
if(copytext(message,1,2) == ";")
|
||||
message_mode = "general" // I don't know why but regular radio = fuck you we ain't broadcasting, pAI mode was what was in old say code.
|
||||
message = trim(copytext(message,2))
|
||||
|
||||
else if(length(message) >= 2)
|
||||
var/channel_prefix = copytext(message, 1 ,3)
|
||||
if(!message_mode)
|
||||
message_mode = department_radio_keys[channel_prefix]
|
||||
|
||||
if(message_mode && bot_type == IS_ROBOT)
|
||||
if(message_mode != "binary" && !R.is_component_functioning("radio"))
|
||||
src << "\red Your radio isn't functional at this time."
|
||||
return
|
||||
|
||||
|
||||
if(message_mode && message_mode != "general")
|
||||
message = trim(copytext(message,3))
|
||||
|
||||
|
||||
//parse radio key and consume it
|
||||
var/message_mode = parse_message_mode(message, "general")
|
||||
if (message_mode)
|
||||
if (message_mode == "general")
|
||||
message = trim(copytext(message,2))
|
||||
else
|
||||
message = trim(copytext(message,3))
|
||||
|
||||
if(message_mode && bot_type == IS_ROBOT && message_mode != "binary" && !R.is_component_functioning("radio"))
|
||||
src << "\red Your radio isn't functional at this time."
|
||||
return
|
||||
|
||||
//parse language key and consume it
|
||||
var/datum/language/speaking = parse_language(message)
|
||||
if (speaking)
|
||||
verb = speaking.speech_verb
|
||||
message = copytext(message,3)
|
||||
|
||||
switch(message_mode)
|
||||
if("department")
|
||||
switch(bot_type)
|
||||
@@ -133,7 +131,7 @@
|
||||
return
|
||||
|
||||
|
||||
return ..(message,null,verb)
|
||||
return ..(message,speaking,verb)
|
||||
|
||||
//For holopads only. Usable by AI.
|
||||
/mob/living/silicon/ai/proc/holopad_talk(var/message)
|
||||
|
||||
@@ -143,11 +143,12 @@
|
||||
return "2"
|
||||
return "0"
|
||||
|
||||
//parses the message mode code (e.g. :h, ;) from text, such as that supplied to say.
|
||||
//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.
|
||||
/mob/proc/parse_message_mode(var/message)
|
||||
//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) == ";")
|
||||
return "headset"
|
||||
return standard_mode
|
||||
|
||||
if(length(message) >= 2)
|
||||
var/channel_prefix = copytext(message, 1 ,3)
|
||||
@@ -156,12 +157,13 @@
|
||||
return null
|
||||
|
||||
//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 knows, otherwise null.
|
||||
//returns the language object only if the code corresponds to a language that src can speak, otherwise null.
|
||||
/mob/proc/parse_language(var/message)
|
||||
if(length(message) >= 2)
|
||||
var/language_prefix = lowertext(copytext(message, 1 ,3))
|
||||
for(var/datum/language/L in src.languages)
|
||||
if(language_prefix == ":[L.key]")
|
||||
return L
|
||||
var/datum/language/L = language_keys[language_prefix]
|
||||
if (can_speak(L))
|
||||
return L
|
||||
|
||||
return null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user