/mob/living/silicon/ai/say(message, bubble_type,var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
if(parent && istype(parent) && parent.stat != DEAD) //If there is a defined "parent" AI, it is actually an AI, and it is alive, anything the AI tries to say is said by the parent instead.
parent.say(message, language)
return
..(message)
/mob/living/silicon/ai/compose_track_href(atom/movable/speaker, namepart)
var/mob/M = speaker.GetSource()
if(M)
return ""
return ""
/mob/living/silicon/ai/compose_job(atom/movable/speaker, message_langs, raw_message, radio_freq)
//Also includes the for AI hrefs, for convenience.
return "[radio_freq ? " (" + speaker.GetJob() + ")" : ""]" + "[speaker.GetSource() ? "" : ""]"
/mob/living/silicon/ai/IsVocal()
return !CONFIG_GET(flag/silent_ai)
/mob/living/silicon/ai/radio(message, message_mode, list/spans, language)
if(incapacitated())
return FALSE
if(!radio_enabled) //AI cannot speak if radio is disabled (via intellicard) or depowered.
to_chat(src, "Your radio transmitter is offline!")
return FALSE
..()
/mob/living/silicon/ai/get_message_mode(message)
if(copytext(message, 1, 3) in list(":h", ":H", ".h", ".H", "#h", "#H"))
return MODE_HOLOPAD
else
return ..()
//For holopads only. Usable by AI.
/mob/living/silicon/ai/proc/holopad_talk(message, language)
message = trim(message)
if (!message)
return
var/obj/machinery/holopad/T = current
if(istype(T) && T.masters[src])//If there is a hologram and its master is the user.
var/turf/padturf = get_turf(T)
var/padloc
if(padturf)
padloc = AREACOORD(padturf)
else
padloc = "(UNKNOWN)"
src.log_talk(message, LOG_SAY, tag="HOLOPAD in [padloc]")
send_speech(message, 7, T, "robot", get_spans(), language)
to_chat(src, "Holopad transmitted, [real_name] \"[message]\"")
else
to_chat(src, "No holopad connected.")
// 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 = {"
WARNING: Misuse of the announcement system will get you job banned.
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.
- You can also click on the word to PREVIEW it.
- You can only say 30 words for every announcement.
- 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'.
- Numbers are in word format, e.g. eight, sixty, etc
- Sound effects begin with an 's' before the actual word, e.g. scensor
- Use Ctrl+F to see if a word exists in the list.
"}
var/index = 0
for(var/word in GLOB.vox_sounds)
index++
dat += "[capitalize(word)]"
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)
to_chat(src, "Please wait [DisplayTimeText(announcing_vox - world.time)].")
return
var/message = input(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", src.last_announcement) as text
last_announcement = message
if(!message || announcing_vox > world.time)
return
if(incapacitated())
return
if(control_disabled)
to_chat(src, "Wireless interface disabled, unable to interact with announcement PA.")
return
var/list/words = splittext(trim(message), " ")
var/list/incorrect_words = list()
if(words.len > 30)
words.len = 30
for(var/word in words)
word = lowertext(trim(word))
if(!word)
words -= word
continue
if(!GLOB.vox_sounds[word])
incorrect_words += word
if(incorrect_words.len)
to_chat(src, "These words are not available on the announcement system: [english_list(incorrect_words)].")
return
announcing_vox = world.time + VOX_DELAY
log_game("[key_name(src)] made a vocal announcement with the following message: [message].")
for(var/word in words)
play_vox_word(word, src.z, null)
/proc/play_vox_word(word, z_level, mob/only_listener)
word = lowertext(word)
if(GLOB.vox_sounds[word])
var/sound_file = GLOB.vox_sounds[word]
var/sound/voice = sound(sound_file, wait = 1, channel = CHANNEL_VOX)
voice.status = SOUND_STREAM
// If there is no single listener, broadcast to everyone in the same z level
if(!only_listener)
// Play voice for all mobs in the z level
for(var/mob/M in GLOB.player_list)
if(M.client && M.can_hear() && (M.client.prefs.toggles & SOUND_ANNOUNCEMENTS))
var/turf/T = get_turf(M)
if(T.z == z_level)
SEND_SOUND(M, voice)
else
SEND_SOUND(only_listener, voice)
return 1
return 0
#undef VOX_DELAY
#endif
/mob/living/silicon/ai/could_speak_in_language(datum/language/dt)
if(is_servant_of_ratvar(src))
// Ratvarian AIs can only speak Ratvarian
. = ispath(dt, /datum/language/ratvar)
else
. = ..()