bark followup - audio balance pass, bark intercepts, yelling nerf, falloff fix, etc!

This commit is contained in:
deathride58
2022-06-11 19:39:48 -04:00
parent 3ec6a024c7
commit 17917ed564
7 changed files with 34 additions and 8 deletions
+6
View File
@@ -72,6 +72,8 @@
var/vocal_volume = 70 //Baseline. This gets modified by yelling and other factors
var/vocal_speed = 4 //Lower values are faster, higher values are slower
var/vocal_current_bark //When barks are queued, this gets passed to the bark proc. If vocal_current_bark doesn't match the args passed to the bark proc (if passed at all), then the bark simply doesn't play. Basic curtailing of spam~
/atom/movable/Initialize(mapload)
. = ..()
switch(blocks_emissive)
@@ -225,6 +227,10 @@
if(NAMEOF(src, glide_size))
set_glide_size(var_value)
. = TRUE
if(NAMEOF(src, vocal_bark))
if(isfile(vocal_bark))
vocal_bark = sound(vocal_bark) //bark() expects vocal_bark to already be a sound datum, for performance reasons. adminbus QoL!
. = TRUE
if(!isnull(.))
datum_flags |= DF_VAR_EDITED
+8 -3
View File
@@ -31,14 +31,18 @@ GLOBAL_LIST_INIT(freqtospan, list(
/atom/movable/proc/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
SEND_SIGNAL(src, COMSIG_MOVABLE_HEAR, args)
/atom/movable/proc/bark(list/hearers, distance, volume, pitch)
/atom/movable/proc/bark(list/hearers, distance, volume, pitch, queue_time)
if(queue_time && vocal_current_bark != queue_time)
return
if(SEND_SIGNAL(src, COMSIG_MOVABLE_BARK, hearers, distance, volume, pitch))
return //bark interception. this probably counts as some flavor of BDSM
if(!vocal_bark)
if(!vocal_bark_id || !set_bark(vocal_bark_id)) //just-in-time bark generation
return
volume = min(volume, 100)
var/turf/T = get_turf(src)
for(var/mob/M in hearers)
M.playsound_local(T, vol = volume, vary = TRUE, frequency = pitch, max_distance = distance, falloff_distance = distance * 0.75, S = vocal_bark, distance_multiplier = 1)
M.playsound_local(T, vol = volume, vary = TRUE, frequency = pitch, max_distance = distance, falloff_distance = 0, falloff_exponent = BARK_SOUND_FALLOFF_EXPONENT(distance), S = vocal_bark, distance_multiplier = 1)
/atom/movable/proc/can_speak()
return 1
@@ -57,10 +61,11 @@ GLOBAL_LIST_INIT(freqtospan, list(
hearers -= M
var/barks = min(round((LAZYLEN(message) / vocal_speed)) + 1, BARK_MAX_BARKS)
var/total_delay
vocal_current_bark = world.time //this is juuuuust random enough to reliably be unique every time send_speech() is called, in most scenarios
for(var/i in 1 to barks)
if(total_delay > BARK_MAX_TIME)
break
addtimer(CALLBACK(src, .proc/bark, hearers, range, vocal_volume, BARK_DO_VARY(vocal_pitch, vocal_pitch_range)), total_delay)
addtimer(CALLBACK(src, .proc/bark, hearers, range, vocal_volume, BARK_DO_VARY(vocal_pitch, vocal_pitch_range), vocal_current_bark), total_delay)
total_delay += rand(DS2TICKS(vocal_speed / BARK_SPEED_BASELINE), DS2TICKS(vocal_speed / BARK_SPEED_BASELINE) + DS2TICKS(vocal_speed / BARK_SPEED_BASELINE)) TICKS
/atom/movable/proc/compose_message(atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode, face_name = FALSE, atom/movable/source)