From 9e52040d5ae957d41a4bfd70ea48c49ec1eb6707 Mon Sep 17 00:00:00 2001 From: Cameron653 Date: Sat, 3 Feb 2018 23:47:01 -0500 Subject: [PATCH] Loadout Text-To-Speech device. (#4697) * TTS Device * Makes it a proper /device * boop * to_chat and message change --- .../objects/items/devices/text_to_speech.dm | 28 +++++++++++++++++++ .../loadout/loadout_utility.dm | 7 ++++- polaris.dme | 1 + 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 code/game/objects/items/devices/text_to_speech.dm diff --git a/code/game/objects/items/devices/text_to_speech.dm b/code/game/objects/items/devices/text_to_speech.dm new file mode 100644 index 0000000000..bc0c9d5304 --- /dev/null +++ b/code/game/objects/items/devices/text_to_speech.dm @@ -0,0 +1,28 @@ +/obj/item/device/text_to_speech + name = "TTS device" + desc = "A device that speaks an inputted message. Given to crew which can not speak properly or at all." + icon = 'icons/obj/electronic_assemblies.dmi' + icon_state = "setup_small" + w_class = ITEMSIZE_SMALL + var/named + +/obj/item/device/text_to_speech/attack_self(mob/user as mob) + if(user.incapacitated(INCAPACITATION_ALL)) //Are you in a state to actual use the device? + to_chat(user, "You cannot activate the device in your state.") + return + + if(!named) + to_chat(user, "You input your name into the device.") + name = "[initial(name)] ([user.real_name])" + desc = "[initial(desc)] This one is assigned to [user.real_name]." + named = 1 + /* //Another way of naming the device. Gives more freedom, but could lead to issues. + device_name = copytext(sanitize(input(user, "What would you like to name your device? You must input a name before the device can be used.", "Name your device", "") as null|text),1,MAX_NAME_LEN) + name = "[initial(name)] - [device_name]" + named = 1 + */ + + var/message = sanitize(input(user,"Choose a message to relay to those around you.") as text|null) + if(message) + var/obj/item/device/text_to_speech/O = src + audible_message("\icon[O] \The [O.name] states, \"[message]\"") diff --git a/code/modules/client/preference_setup/loadout/loadout_utility.dm b/code/modules/client/preference_setup/loadout/loadout_utility.dm index 91f1ebf634..cacd0451a4 100644 --- a/code/modules/client/preference_setup/loadout/loadout_utility.dm +++ b/code/modules/client/preference_setup/loadout/loadout_utility.dm @@ -8,6 +8,11 @@ display_name = "clipboard" path = /obj/item/weapon/clipboard +/datum/gear/utility/tts_device + display_name = "text to speech device" + path = /obj/item/device/text_to_speech + cost = 3 //Not extremely expensive, but it's useful for mute chracters. + /datum/gear/utility/communicator display_name = "communicator selection" path = /obj/item/device/communicator @@ -29,7 +34,7 @@ display_name = "the traveler's guide to vir" path = /obj/item/weapon/book/codex/lore/vir cost = 0 - + /datum/gear/utility/news display_name = "daedalus pocket newscaster" path = /obj/item/weapon/book/codex/lore/news diff --git a/polaris.dme b/polaris.dme index f013228fd6..5cc6b381fb 100644 --- a/polaris.dme +++ b/polaris.dme @@ -851,6 +851,7 @@ #include "code\game\objects\items\devices\suit_cooling.dm" #include "code\game\objects\items\devices\t_scanner.dm" #include "code\game\objects\items\devices\taperecorder.dm" +#include "code\game\objects\items\devices\text_to_speech.dm" #include "code\game\objects\items\devices\traitordevices.dm" #include "code\game\objects\items\devices\transfer_valve.dm" #include "code\game\objects\items\devices\translator.dm"