Skip to content

Commit

Permalink
TTS - clear channels list and use max_distance for local playsound (#216
Browse files Browse the repository at this point in the history
)

## About The Pull Request
Очищает список tts_local_channels_by_owner, когда владелец канала
удаляется

Копирка ТГ-шного playsound_local для вывода ТТС. Функционально,
добавлена только max_distance
  • Loading branch information
larentoun authored Apr 24, 2024
1 parent 46416f7 commit 3aab373
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions modular_bandastation/tts/code/tts_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,19 @@ SUBSYSTEM_DEF(tts220)
if(speaking_mob.client)
output.channel = get_local_channel_by_owner(speaker)
output.wait = TRUE
output = listener.playsound_local(turf_source, vol = output.volume, channel = output.channel, sound_to_use = output, wait = output.wait)

if(!output || output.volume <= 0)
return
listener.playsound_local(
turf_source,
vol = output.volume,
falloff_exponent = SOUND_FALLOFF_EXPONENT,
channel = output.channel,
pressure_affected = TRUE,
sound_to_use = output,
max_distance = SOUND_RANGE,
falloff_distance = SOUND_DEFAULT_FALLOFF_DISTANCE,
distance_multiplier = 1,
use_reverb = TRUE,
wait = output.wait
)

play_sfx_if_exists(listener, postSFX, output)

Expand All @@ -405,8 +414,14 @@ SUBSYSTEM_DEF(tts220)
if(isnull(channel))
channel = SSsounds.reserve_sound_channel()
tts_local_channels_by_owner[owner] = channel
RegisterSignal(owner, COMSIG_QDELETING, PROC_REF(clear_channel))
return channel

/datum/controller/subsystem/tts220/proc/clear_channel(owner)
SIGNAL_HANDLER

tts_local_channels_by_owner -= owner

/datum/controller/subsystem/tts220/proc/cleanup_tts_file(filename)
fdel(filename)

Expand Down

0 comments on commit 3aab373

Please sign in to comment.