Merge pull request #6295 from Mechoid/TTS_And_Sign

Adds an advanced TTS circuit, and sign-camera.
This commit is contained in:
Atermonera
2019-08-05 14:51:00 -08:00
committed by VirgoBot
parent 3ecec80c42
commit e60f0daf47
5 changed files with 120 additions and 0 deletions

View File

@@ -173,6 +173,9 @@
*/
return
/obj/proc/hear_signlang(mob/M as mob, text, verb, datum/language/speaking) // Saycode gets worse every day.
return FALSE
/obj/proc/see_emote(mob/M as mob, text, var/emote_type)
return

View File

@@ -540,7 +540,57 @@
if(translated)
activate_pin(2)
/obj/item/integrated_circuit/input/microphone/sign
name = "sign-language translator"
desc = "Useful for spying on people or for sign activated machines."
extended_desc = "This will automatically translate galactic standard sign language it sees to Galactic Common. \
The first activation pin is always pulsed when the circuit sees someone speak sign, while the second one \
is only triggered if it sees someone speaking a language other than sign language, which it will attempt to \
lip-read."
icon_state = "video_camera"
complexity = 12
inputs = list()
outputs = list(
"speaker" = IC_PINTYPE_STRING,
"message" = IC_PINTYPE_STRING
)
activators = list("on message received" = IC_PINTYPE_PULSE_OUT, "on translation" = IC_PINTYPE_PULSE_OUT)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 30
var/list/my_langs = list()
var/list/readable_langs = list(
LANGUAGE_GALCOM,
LANGUAGE_SOL_COMMON,
LANGUAGE_TRADEBAND,
LANGUAGE_GUTTER,
LANGUAGE_TERMINUS
)
/obj/item/integrated_circuit/input/microphone/sign/Initialize()
..()
for(var/lang in readable_langs)
var/datum/language/newlang = all_languages[lang]
my_langs |= newlang
/obj/item/integrated_circuit/input/microphone/sign/hear_talk(mob/living/M, msg, var/verb="says", datum/language/speaking=null)
var/translated = FALSE
if(M && msg)
if(speaking)
if(!((speaking.flags & NONVERBAL) || (speaking.flags & SIGNLANG)))
translated = TRUE
msg = speaking.scramble(msg, my_langs)
set_pin_data(IC_OUTPUT, 1, M.GetVoice())
set_pin_data(IC_OUTPUT, 2, msg)
push_data()
activate_pin(1)
if(translated)
activate_pin(2)
/obj/item/integrated_circuit/input/microphone/sign/hear_signlang(text, verb, datum/language/speaking, mob/M as mob)
hear_talk(M, text, verb, speaking)
return
/obj/item/integrated_circuit/input/sensor
name = "sensor"

View File

@@ -136,6 +136,33 @@
var/obj/O = assembly ? loc : assembly
audible_message("\icon[O] \The [O.name] states, \"[text]\"")
/obj/item/integrated_circuit/output/text_to_speech/advanced
name = "advanced text-to-speech circuit"
desc = "A miniature speaker is attached to this component. It is able to transpose any valid text to speech, matching a scanned target's voice."
complexity = 15
cooldown_per_use = 6 SECONDS
inputs = list("text" = IC_PINTYPE_STRING, "mimic target" = IC_PINTYPE_REF)
power_draw_per_use = 100
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 4, TECH_ILLEGAL = 1)
var/mob/living/voice/my_voice
/obj/item/integrated_circuit/output/text_to_speech/advanced/Initialize()
..()
my_voice = new (src)
my_voice.name = "TTS Circuit"
/obj/item/integrated_circuit/output/text_to_speech/advanced/do_work()
text = get_pin_data(IC_INPUT, 1)
var/mob/living/target_mob = get_pin_data(IC_INPUT, 2)
my_voice.transfer_identity(target_mob)
if(!isnull(text) && !isnull(my_voice) && !isnull(my_voice.name))
my_voice.forceMove(get_turf(src))
my_voice.say("[text]")
my_voice.forceMove(src)
/obj/item/integrated_circuit/output/sound
name = "speaker circuit"
desc = "A miniature speaker is attached to this component."

View File

@@ -413,6 +413,10 @@ proc/get_radio_key_from_channel(var/channel)
for(var/hearer in mobs)
var/mob/M = hearer
M.hear_signlang(message, verb, language, src)
var/list/objs = potentials["objs"]
for(var/hearer in objs)
var/obj/O = hearer
O.hear_signlang(message, verb, language, src)
return 1
/obj/effect/speech_bubble