mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Adds the ear translator
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
icon_state = "translator"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
origin_tech = list(TECH_DATA = 3, TECH_ENGINEERING = 3)
|
||||
var/mult_icons = 1 //Changes sprite when it translates
|
||||
var/visual = 1 //If you need to see to get the message
|
||||
var/audio = 0 //If you need to hear to get the message
|
||||
var/listening = 0
|
||||
var/datum/language/langset
|
||||
|
||||
@@ -15,7 +18,8 @@
|
||||
if(langset)
|
||||
listening = 1
|
||||
listening_objects |= src
|
||||
icon_state = "[initial(icon_state)]1"
|
||||
if(mult_icons)
|
||||
icon_state = "[initial(icon_state)]1"
|
||||
to_chat(user, "<span class='notice'>You enable \the [src], translating into [langset.name].</span>")
|
||||
else //Turning OFF
|
||||
listening = 0
|
||||
@@ -29,7 +33,8 @@
|
||||
return
|
||||
|
||||
//Show the "I heard something" animation.
|
||||
flick("[initial(icon_state)]2",src)
|
||||
if(mult_icons)
|
||||
flick("[initial(icon_state)]2",src)
|
||||
|
||||
//Handheld or pocket only.
|
||||
if(!isliving(loc))
|
||||
@@ -40,15 +45,31 @@
|
||||
if (language && (language.flags & NONVERBAL))
|
||||
return //Not gonna translate sign language
|
||||
|
||||
if (visual && ((L.sdisabilities & BLIND) || L.eye_blind))
|
||||
return //Can't see the screen, don't get the message
|
||||
|
||||
if (audio && ((L.sdisabilities & DEAF) || L.ear_deaf))
|
||||
return //Can't hear the translation, don't get the message
|
||||
|
||||
//Only translate if they can't understand, otherwise pointlessly spammy
|
||||
//I'll just assume they don't look at the screen in that case
|
||||
|
||||
//They don't understand the spoken language we're translating FROM
|
||||
if(!L.say_understands(speaker,language))
|
||||
//They understand the PRINTED language
|
||||
//They understand the output language
|
||||
if(L.say_understands(null,langset))
|
||||
to_chat(L, "<i><b>[src]</b> displays, </i>\"<span class='[langset.colour]'>[message]</span>\"")
|
||||
to_chat(L, "<i><b>[src]</b> translates, </i>\"<span class='[langset.colour]'>[message]</span>\"")
|
||||
|
||||
//They don't understand the PRINTED language
|
||||
//They don't understand the output language
|
||||
else
|
||||
to_chat(L, "<i><b>[src]</b> displays, </i>\"<span class='[langset.colour]'>[langset.scramble(message)]</span>\"")
|
||||
to_chat(L, "<i><b>[src]</b> translates, </i>\"<span class='[langset.colour]'>[langset.scramble(message)]</span>\"")
|
||||
|
||||
//Let's try an ear-worn version
|
||||
/obj/item/device/universal_translator/ear
|
||||
name = "translator earpiece"
|
||||
desc = "This handy device appears to translate the languages it hears into another language for a user."
|
||||
icon_state = "earpiece"
|
||||
w_class = ITEMSIZE_TINY
|
||||
slot_flags = SLOT_EARS
|
||||
visual = 0
|
||||
audio = 1
|
||||
Reference in New Issue
Block a user