This commit is contained in:
SandPoot
2024-05-21 00:06:26 -03:00
parent 2e5e548369
commit 912ca1e374
8 changed files with 178 additions and 61 deletions

View File

@@ -974,10 +974,11 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
addtimer(CALLBACK(SSassets.transport, TYPE_PROC_REF(/datum/asset_transport, send_assets_slow), src, SSassets.transport.preload), 5 SECONDS)
#if (PRELOAD_RSC == 0)
for (var/name in GLOB.vox_sounds)
var/file = GLOB.vox_sounds[name]
Export("##action=load_rsc", file)
stoplag()
for (var/type in GLOB.vox_types)
for(var/word in GLOB.vox_types[type])
var/file = GLOB.vox_types[type][word]
Export("##action=load_rsc", file)
stoplag()
#endif

View File

@@ -226,15 +226,22 @@
spawn_flags = IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/output/sound/vox
name = "ai vox sound circuit"
name = "Female ai vox sound circuit"
desc = "Takes a sound name as an input, and will play said sound when pulsed. This circuit is often found in AI announcement systems."
spawn_flags = IC_SPAWN_RESEARCH
var/voice_type = "Female"
/obj/item/integrated_circuit/output/sound/vox/Initialize(mapload)
.= ..()
sounds = GLOB.vox_sounds
. = ..()
sounds = GLOB.vox_types[voice_type]
extended_desc = "The first input pin determines which sound is used. It uses the AI Vox Broadcast word list. So either experiment to find words that work, or ask the AI to help in figuring them out. The second pin determines the volume of sound that is played, and the third determines if the frequency of the sound will vary with each activation."
/obj/item/integrated_circuit/output/sound/vox/male
name = "Male ai vox sound circuit"
desc = "Takes a sound name as an input, and will play said sound when pulsed. This circuit is often found in AI announcement systems."
spawn_flags = IC_SPAWN_RESEARCH
voice_type = "Male"
/obj/item/integrated_circuit/output/text_to_speech
name = "text-to-speech circuit"
desc = "Takes any string as an input and will make the device say the string when pulsed."

View File

@@ -104,6 +104,8 @@
// TODO: Currently unused, needs port from TG.
/// Station alert datum for showing alerts UI
var/datum/station_alert/alert_control
/// Lists possible spoken words for announcements
var/datum/announcement_help/announcement_help
///remember AI's last location
var/atom/lastloc
interaction_range = INFINITY
@@ -204,6 +206,7 @@
QDEL_NULL(doomsday_device)
QDEL_NULL(robot_control)
// QDEL_NULL(alert_control)
QDEL_NULL(announcement_help)
QDEL_NULL(aiMulti)
QDEL_NULL(aiPDA)
malfhack = null

View File

@@ -0,0 +1,54 @@
#ifdef AI_VOX
/mob/living/silicon/ai/verb/announcement_help()
set name = "Announcement Help"
set desc = "Display a list of vocal words to announce to the crew."
set category = "AI Commands"
if(incapacitated())
return
if(!announcement_help)
announcement_help = new(src)
announcement_help.ui_interact(src)
/datum/announcement_help
var/mob/living/silicon/ai/owner
/datum/announcement_help/New(mob/living/silicon/ai/new_owner)
if(!istype(new_owner))
qdel(src)
owner = new_owner
/datum/announcement_help/ui_status(mob/living/silicon/ai/user)
if(owner == user && !owner.incapacitated())
return ..()
return UI_CLOSE
/datum/announcement_help/ui_state(mob/user)
return GLOB.always_state
/datum/announcement_help/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AnnouncementHelp")
ui.open()
/datum/announcement_help/ui_static_data(mob/user)
var/list/data = ..()
data["vox_types"] = GLOB.vox_types
return data
/datum/announcement_help/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
switch(action)
if("say_word")
var/vox_type = params["vox_type"]
if(!vox_type)
return
var/to_speak = params["to_speak"]
if(!to_speak)
return
play_vox_word(to_speak, null, owner, vox_type)
#endif

View File

@@ -80,38 +80,6 @@
// Make sure that the code compiles with AI_VOX undefined
#ifdef AI_VOX
#define VOX_DELAY 600
/mob/living/silicon/ai/verb/announcement_help()
set name = "Announcement Help"
set desc = "Display a list of vocal words to announce to the crew."
set category = "AI Commands"
if(incapacitated())
return
var/dat = {"
<font class='bad'>WARNING:</font> Misuse of the announcement system will get you job banned.<BR><BR>
Here is a list of words you can type into the 'Announcement' button to create sentences to vocally announce to everyone on the same level at you.<BR>
<UL><LI>You can also click on the word to PREVIEW it.</LI>
<LI>You can only say 30 words for every announcement.</LI>
<LI>Do not use punctuation as you would normally, if you want a pause you can use the full stop and comma characters by separating them with spaces, like so: 'Alpha . Test , Bravo'.</LI>
<LI>Numbers are in word format, e.g. eight, sixty, etc </LI>
<LI>Sound effects begin with an 's' before the actual word, e.g. scensor</LI>
<LI>Use Ctrl+F to see if a word exists in the list.</LI></UL><HR>
"}
var/index = 0
for(var/word in GLOB.vox_sounds)
index++
dat += "<A href='?src=[REF(src)];say_word=[word]'>[capitalize(word)]</A>"
if(index != GLOB.vox_sounds.len)
dat += " / "
var/datum/browser/popup = new(src, "announce_help", "Announcement Help", 500, 400)
popup.set_content(dat)
popup.open()
/mob/living/silicon/ai/proc/announcement()
var/static/announcing_vox = 0 // Stores the time of the last announcement
if(announcing_vox > world.time)
@@ -122,7 +90,7 @@
last_announcement = message
var/voxType = input(src, "Male or female VOX?", "VOX-gender") in list("male", "female")
var/voxType = input(src, "Male or female VOX?", "VOX-gender") in GLOB.vox_types
if(!message || announcing_vox > world.time)
return
@@ -145,9 +113,7 @@
if(!word)
words -= word
continue
if(!GLOB.vox_sounds[word] && voxType == "female")
incorrect_words += word
if(!GLOB.vox_sounds_male[word] && voxType == "male")
if(!GLOB.vox_types[voxType][word])
incorrect_words += word
if(incorrect_words.len)
@@ -162,18 +128,12 @@
play_vox_word(word, src.z, null, voxType)
/proc/play_vox_word(word, z_level, mob/only_listener, voxType = "female")
/proc/play_vox_word(word, z_level, mob/only_listener, voxType = "Female")
word = lowertext(word)
if( (GLOB.vox_sounds[word] && voxType == "female") || (GLOB.vox_sounds_male[word] && voxType == "male") )
var/sound_file
if(voxType == "female")
sound_file = GLOB.vox_sounds[word]
else
sound_file = GLOB.vox_sounds_male[word]
var/sound_file = LAZYACCESSASSOC(GLOB.vox_types, voxType, word)
if(sound_file)
var/sound/voice = sound(sound_file, wait = 1, channel = CHANNEL_VOX)
voice.status = SOUND_STREAM

View File

@@ -5,9 +5,11 @@
// Regex for collecting a list of ogg files
// (([a-zA-Z,.]+)\.ogg)
// For vim
// :%s/\(\(.*\)\.ogg\)/"\2" = 'sound\/vox_fem\/\1',/g
GLOBAL_LIST_INIT(vox_sounds, list("abduction" = 'sound/vox_fem/abduction.ogg',
GLOBAL_LIST_INIT(vox_types, list(
// For vim
// :%s/\(\(.*\)\.ogg\)/"\2" = 'sound\/vox_fem\/\1',/g
"Female" = list(
"abduction" = 'sound/vox_fem/abduction.ogg',
"abortions" = 'sound/vox_fem/abortions.ogg',
"above" = 'sound/vox_fem/above.ogg',
"abstain" = 'sound/vox_fem/abstain.ogg',
@@ -974,11 +976,11 @@ GLOBAL_LIST_INIT(vox_sounds, list("abduction" = 'sound/vox_fem/abduction.ogg',
"z" = 'sound/vox_fem/z.ogg',
"zombie" = 'sound/vox_fem/zombie.ogg',
"zone" = 'sound/vox_fem/zone.ogg',
"zulu" = 'sound/vox_fem/zulu.ogg'))
//for vim
// :%s/\(\(.*\)\.ogg\)/"\2" = 'sound\/vox\/\1',/g
GLOBAL_LIST_INIT(vox_sounds_male, list("," = 'sound/vox/_comma.ogg',
"zulu" = 'sound/vox_fem/zulu.ogg'),
//for vim
// :%s/\(\(.*\)\.ogg\)/"\2" = 'sound\/vox\/\1',/g
"Male" = list(
"," = 'sound/vox/_comma.ogg',
"." = 'sound/vox/_period.ogg',
"a" = 'sound/vox/a.ogg',
"accelerating" = 'sound/vox/accelerating.ogg',
@@ -1605,5 +1607,6 @@ GLOBAL_LIST_INIT(vox_sounds_male, list("," = 'sound/vox/_comma.ogg',
"yourself" = 'sound/vox/yourself.ogg',
"zero" = 'sound/vox/zero.ogg',
"zone" = 'sound/vox/zone.ogg',
"zulu" = 'sound/vox/zulu.ogg',))
"zulu" = 'sound/vox/zulu.ogg',
)))
#endif