Skip to content

Commit

Permalink
tts interrupt signal (#609)
Browse files Browse the repository at this point in the history
## About The Pull Request
Ports ss220club/Paradise-SS220#1612
  • Loading branch information
larentoun authored Oct 24, 2024
1 parent 3d6638a commit caddd66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion modular_bandastation/_defines220/code/signals_atom.dm
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 3 additions & 1 deletion modular_bandastation/tts/code/hear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions modular_bandastation/tts/code/tts_seed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit caddd66

Please sign in to comment.