mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 11:43:31 +00:00
Ports the translator
This commit is contained in:
54
code/game/objects/items/devices/translator.dm
Normal file
54
code/game/objects/items/devices/translator.dm
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
//Universal translator
|
||||||
|
/obj/item/device/universal_translator
|
||||||
|
name = "handheld translator"
|
||||||
|
desc = "This handy device appears to translate the languages it hears into onscreen text for a user."
|
||||||
|
icon = 'icons/obj/device.dmi'
|
||||||
|
icon_state = "translator"
|
||||||
|
w_class = ITEMSIZE_SMALL
|
||||||
|
origin_tech = list(TECH_DATA = 3, TECH_ENGINEERING = 3)
|
||||||
|
var/listening = 0
|
||||||
|
var/datum/language/langset
|
||||||
|
|
||||||
|
/obj/item/device/universal_translator/attack_self(mob/user)
|
||||||
|
if(!listening) //Turning ON
|
||||||
|
langset = input(user,"Translate to which of your languages?","Language Selection") as null|anything in user.languages
|
||||||
|
if(langset)
|
||||||
|
listening = 1
|
||||||
|
listening_objects |= src
|
||||||
|
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
|
||||||
|
listening_objects -= src
|
||||||
|
langset = null
|
||||||
|
icon_state = "[initial(icon_state)]"
|
||||||
|
to_chat(user, "<span class='notice'>You disable \the [src].</span>")
|
||||||
|
|
||||||
|
/obj/item/device/universal_translator/hear_talk(var/mob/speaker, var/message, var/vrb, var/datum/language/language)
|
||||||
|
if(!listening || !istype(speaker))
|
||||||
|
return
|
||||||
|
|
||||||
|
//Show the "I heard something" animation.
|
||||||
|
flick("[initial(icon_state)]2",src)
|
||||||
|
|
||||||
|
//Handheld or pocket only.
|
||||||
|
if(!isliving(loc))
|
||||||
|
return
|
||||||
|
|
||||||
|
var/mob/living/L = loc
|
||||||
|
|
||||||
|
if (language && (language.flags & NONVERBAL))
|
||||||
|
return //Not gonna translate sign language
|
||||||
|
|
||||||
|
//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
|
||||||
|
if(L.say_understands(null,langset))
|
||||||
|
to_chat(L, "<i><b>[src]</b> displays, </i>\"<span class='[langset.colour]'>[message]</span>\"")
|
||||||
|
|
||||||
|
//They don't understand the PRINTED language
|
||||||
|
else
|
||||||
|
to_chat(L, "<i><b>[src]</b> displays, </i>\"<span class='[langset.colour]'>[langset.scramble(message)]</span>\"")
|
||||||
@@ -61,3 +61,8 @@
|
|||||||
cost = 2
|
cost = 2
|
||||||
slot = "implant"
|
slot = "implant"
|
||||||
var/implant_type = "EAL"
|
var/implant_type = "EAL"
|
||||||
|
|
||||||
|
/datum/gear/utility/translator
|
||||||
|
display_name = "universal translator"
|
||||||
|
path = /obj/item/device/universal_translator
|
||||||
|
cost = 5
|
||||||
|
|||||||
@@ -1586,6 +1586,14 @@ CIRCUITS BELOW
|
|||||||
build_path = /obj/item/weapon/implant/integrated_circuit
|
build_path = /obj/item/weapon/implant/integrated_circuit
|
||||||
sort_string = "VCAAE"
|
sort_string = "VCAAE"
|
||||||
|
|
||||||
|
/datum/design/item/translator
|
||||||
|
name = "handheld translator"
|
||||||
|
id = "translator"
|
||||||
|
req_tech = list(TECH_DATA = 3, TECH_ENGINEERING = 3)
|
||||||
|
materials = list(DEFAULT_WALL_MATERIAL = 2000, "glass" = 2000)
|
||||||
|
build_path = /obj/item/device/universal_translator
|
||||||
|
sort_string = "HABBA"
|
||||||
|
|
||||||
/* Uncomment if someone makes these buildable
|
/* Uncomment if someone makes these buildable
|
||||||
/datum/design/circuit/general_alert
|
/datum/design/circuit/general_alert
|
||||||
name = "general alert console"
|
name = "general alert console"
|
||||||
|
|||||||
36
html/changelogs/Anewbe - Translator.yml
Normal file
36
html/changelogs/Anewbe - Translator.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
################################
|
||||||
|
# Example Changelog File
|
||||||
|
#
|
||||||
|
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||||
|
#
|
||||||
|
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||||
|
# When it is, any changes listed below will disappear.
|
||||||
|
#
|
||||||
|
# Valid Prefixes:
|
||||||
|
# bugfix
|
||||||
|
# wip (For works in progress)
|
||||||
|
# tweak
|
||||||
|
# soundadd
|
||||||
|
# sounddel
|
||||||
|
# rscadd (general adding of nice things)
|
||||||
|
# rscdel (general deleting of nice things)
|
||||||
|
# imageadd
|
||||||
|
# imagedel
|
||||||
|
# maptweak
|
||||||
|
# spellcheck (typo fixes)
|
||||||
|
# experiment
|
||||||
|
#################################
|
||||||
|
|
||||||
|
# Your name.
|
||||||
|
author: Anewbe
|
||||||
|
|
||||||
|
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||||
|
delete-after: True
|
||||||
|
|
||||||
|
# Any changes you've made. See valid prefix list above.
|
||||||
|
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||||
|
# SCREW THIS UP AND IT WON'T WORK.
|
||||||
|
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
|
||||||
|
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
|
||||||
|
changes:
|
||||||
|
- rscadd: "Adds a universal translator device, courtesy of a downstream."
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 49 KiB |
@@ -779,6 +779,7 @@
|
|||||||
#include "code\game\objects\items\devices\taperecorder.dm"
|
#include "code\game\objects\items\devices\taperecorder.dm"
|
||||||
#include "code\game\objects\items\devices\traitordevices.dm"
|
#include "code\game\objects\items\devices\traitordevices.dm"
|
||||||
#include "code\game\objects\items\devices\transfer_valve.dm"
|
#include "code\game\objects\items\devices\transfer_valve.dm"
|
||||||
|
#include "code\game\objects\items\devices\translator.dm"
|
||||||
#include "code\game\objects\items\devices\tvcamera.dm"
|
#include "code\game\objects\items\devices\tvcamera.dm"
|
||||||
#include "code\game\objects\items\devices\uplink.dm"
|
#include "code\game\objects\items\devices\uplink.dm"
|
||||||
#include "code\game\objects\items\devices\uplink_random_lists.dm"
|
#include "code\game\objects\items\devices\uplink_random_lists.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user