From caddd66f4285c4558cfbc93cf5e624553f4f3e45 Mon Sep 17 00:00:00 2001 From: larentoun <31931237+larentoun@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:17:03 +0300 Subject: [PATCH] tts interrupt signal (#609) ## About The Pull Request Ports https://github.com/ss220club/Paradise-SS220/pull/1612 --- modular_bandastation/_defines220/code/signals_atom.dm | 5 ++++- modular_bandastation/tts/code/hear.dm | 4 +++- modular_bandastation/tts/code/tts_seed.dm | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modular_bandastation/_defines220/code/signals_atom.dm b/modular_bandastation/_defines220/code/signals_atom.dm index 6cb23c4e1f485..e579f384139b5 100644 --- a/modular_bandastation/_defines220/code/signals_atom.dm +++ b/modular_bandastation/_defines220/code/signals_atom.dm @@ -1,7 +1,10 @@ ///from base of atom/change_tts_seed(): (mob/chooser, override, new_traits) #define COMSIG_ATOM_TTS_SEED_CHANGE "atom_tts_seed_change" -///from base of atom/cast_tts: (mob/listener, message, atom/location, is_local, effect, traits, preSFX, postSFX) +///from base of atom/cast_tts(): (mob/listener, message, atom/location, is_local, effect, traits, preSFX, postSFX) #define COMSIG_ATOM_TTS_CAST "atom_tts_cast" +//from base of atom/cast_tts(): (mob/listener, message, atom/location, is_local, effect, traits, preSFX, postSFX) +#define COMSIG_ATOM_PRE_TTS_CAST "atom_pre_tts_cast" + #define COMPONENT_TTS_INTERRUPT (1<<0) ///from base of atom/tts_trait_add(): (trait) #define COMSIG_ATOM_TTS_TRAIT_ADD "atom_tts_trait_add" ///from base of atom/tts_trait_remove(): (trait) diff --git a/modular_bandastation/tts/code/hear.dm b/modular_bandastation/tts/code/hear.dm index 291502ea0d74b..94ec707c1c6ad 100644 --- a/modular_bandastation/tts/code/hear.dm +++ b/modular_bandastation/tts/code/hear.dm @@ -21,4 +21,6 @@ speaker.cast_tts(src, raw_message, effect = radio_freq ? /datum/singleton/sound_effect/radio : null) /atom/movable/virtualspeaker/cast_tts(mob/listener, message, atom/location, is_local, effect, traits, preSFX, postSFX) - SEND_SIGNAL(source, COMSIG_ATOM_TTS_CAST, listener, message, location, is_local, effect, traits, preSFX, postSFX) + if(SEND_SIGNAL(source, COMSIG_ATOM_PRE_TTS_CAST, listener, message, location, is_local, effect, traits, preSFX, postSFX) & COMPONENT_TTS_INTERRUPT) + return + SEND_SIGNAL(source, COMSIG_ATOM_TTS_CAST, listener, message, location, is_local, effect, traits, preSFX, postSFX) diff --git a/modular_bandastation/tts/code/tts_seed.dm b/modular_bandastation/tts/code/tts_seed.dm index 23c005e0a660b..68f7bcaa8ab88 100644 --- a/modular_bandastation/tts/code/tts_seed.dm +++ b/modular_bandastation/tts/code/tts_seed.dm @@ -20,6 +20,8 @@ add_tts_component() /atom/proc/cast_tts(mob/listener, message, atom/location, is_local = TRUE, effect = null, traits = TTS_TRAIT_RATE_FASTER, preSFX, postSFX) + if(SEND_SIGNAL(src, COMSIG_ATOM_PRE_TTS_CAST, listener, message, location, is_local, effect, traits, preSFX, postSFX) & COMPONENT_TTS_INTERRUPT) + return SEND_SIGNAL(src, COMSIG_ATOM_TTS_CAST, listener, message, location, is_local, effect, traits, preSFX, postSFX) // TODO: Do it better?