Skip to content

Commit

Permalink
helper proc for signal?
Browse files Browse the repository at this point in the history
  • Loading branch information
larentoun committed Feb 26, 2024
1 parent b87a075 commit a3df706
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions modular_ss220/text_to_speech/code/hear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ GLOBAL_DATUM_INIT(default_announcer, /datum/tts_seed, new /datum/tts_seed/silero

/mob/hear_say(list/message_pieces, verb, italics, mob/speaker, sound/speech_sound, sound_vol, sound_frequency, use_voice)
. = ..()
SEND_SIGNAL(speaker, COMSIG_ATOM_TTS_CAST, src, message_pieces, speaker, TRUE)
speaker.cast_tts(src, message_pieces)

/mob/hear_radio(list/message_pieces, verb, part_a, part_b, mob/speaker, hard_to_hear = 0, vname, atom/follow_target, check_name_against)
. = ..()
if(hard_to_hear)
return
SEND_SIGNAL(speaker, COMSIG_ATOM_TTS_CAST, src, message_pieces, src, FALSE, SOUND_EFFECT_RADIO, null, null, 'modular_ss220/text_to_speech/code/sound/radio_chatter.ogg')
speaker.cast_tts(src, message_pieces, src, FALSE, SOUND_EFFECT_RADIO, postSFX = 'modular_ss220/text_to_speech/code/sound/radio_chatter.ogg')

/mob/hear_holopad_talk(list/message_pieces, verb, mob/speaker, obj/effect/overlay/holo_pad_hologram/H)
. = ..()
SEND_SIGNAL(speaker, COMSIG_ATOM_TTS_CAST, src, message_pieces, H, TRUE, SOUND_EFFECT_RADIO)
speaker.cast_tts(src, message_pieces, H, TRUE, SOUND_EFFECT_RADIO)

/datum/announcer/Message(message, garbled_message, receivers, garbled_receivers)
var/datum/tts_seed/tts_seed = SStts220.tts_seeds[GLOB.default_announcer.name]
Expand All @@ -38,4 +38,4 @@ GLOBAL_DATUM_INIT(default_announcer, /datum/tts_seed, new /datum/tts_seed/silero
if(!message)
return
for(var/mob/M in get_mobs_in_view(7, src))
SEND_SIGNAL(src, COMSIG_ATOM_TTS_CAST, M, message, src)
cast_tts(M, message)
3 changes: 3 additions & 0 deletions modular_ss220/text_to_speech/code/tts_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
. = ..()
add_tts_component()

/atom/proc/cast_tts(mob/listener, message, atom/location, is_local = TRUE, effect = SOUND_EFFECT_NONE, traits = TTS_TRAIT_RATE_FASTER, preSFX, postSFX)
SEND_SIGNAL(src, COMSIG_ATOM_TTS_CAST, listener, message, location, is_local, effect, traits, preSFX, postSFX)

// TODO: Do it better?
/atom/proc/get_tts_seed()
var/datum/component/tts_component/tts_component = GetComponent(/datum/component/tts_component)
Expand Down
2 changes: 1 addition & 1 deletion modular_ss220/text_to_speech/code/tts_megaphone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
for(var/mob/M in get_mobs_in_view(14, src))
if(!M.client)
continue
SEND_SIGNAL(user, COMSIG_ATOM_TTS_CAST, M, message, user, FALSE, SOUND_EFFECT_MEGAPHONE)
user.cast_tts(M, message, user, FALSE, SOUND_EFFECT_MEGAPHONE)

0 comments on commit a3df706

Please sign in to comment.