diff --git a/code/datums/soundOutput.dm b/code/datums/soundOutput.dm index a0c21106ac4c..f5960077dce9 100644 --- a/code/datums/soundOutput.dm +++ b/code/datums/soundOutput.dm @@ -6,6 +6,7 @@ var/status_flags = 0 //For things like ear deafness, psychodelic effects, and other things that change how all sounds behave var/list/echo var/list/current_sounds = list() + var/list/source_sounds = list() /datum/soundOutput/New(client/C) if(!C) @@ -15,7 +16,7 @@ RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(update_sounds)) . = ..() -#define SMOOTHING 1 // How much smoothing when moving between tiles, smaller is more smoothing +#define SMOOTHING 1 // How much smoothing when moving between tiles, smaller value means more smoothing /datum/soundOutput/proc/update_sounds(atom/user, direction) SIGNAL_HANDLER @@ -31,6 +32,22 @@ process_sound(current_sounds[channel], TRUE, -1+i/32) if(8) process_sound(current_sounds[channel], TRUE, 1-i/32, 0) + +/datum/soundOutput/proc/update_sounds_from_source(atom/source, direction) + SIGNAL_HANDLER + for(var/channel in source_sounds[source]) + for(var/i in 0 to round(32/SMOOTHING)) + i = i * SMOOTHING + switch(direction) + if(1) + process_sound(current_sounds[channel], TRUE, 0, 1+i/32) + if(2) + process_sound(current_sounds[channel], TRUE, 0, -1-i/32) + if(4) + process_sound(current_sounds[channel], TRUE, 1+i/32) + if(8) + process_sound(current_sounds[channel], TRUE, -1-i/32, 0) + /datum/soundOutput/proc/remove_sound(channel) current_sounds -= channel @@ -46,12 +63,16 @@ S.status = update ? SOUND_UPDATE : T.status S.echo = T.echo if(!update) - S.params = list("on-end" = ".soundend [S.channel]") + S.params = list("on-end" = ".soundend [S.channel] [T.source]") var/turf/source_turf if(!QDELETED(T.source)) source_turf = get_turf(T.source) + + if(!update && istype(T.source, /atom/movable)) + source_sounds[T.source] = T + RegisterSignal(T.source, COMSIG_MOVABLE_MOVED, PROC_REF(update_sounds)) else source_turf = locate(T.x, T.y, T.z) @@ -83,10 +104,14 @@ current_sounds[num2text(S.channel)] = T sound_to(owner, S) -/client/verb/sound_ended(channel as num) +/client/verb/sound_ended(channel as num, source as atom) set name = ".soundend" soundOutput.remove_sound(num2text(channel)) + + if(soundOutput.source_sounds[source]) + soundOutput.source_sounds -= source + UnregisterSignal(source, COMSIG_MOVABLE_MOVED) /datum/soundOutput/proc/update_ambience(area/target_area, ambience_override, force_update = FALSE) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/runner/runner_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/runner/runner_powers.dm index aac597441fd9..37e5083ab924 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/runner/runner_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/runner/runner_powers.dm @@ -126,7 +126,7 @@ multitile_vehicle.take_damage_type(20 / acid.acid_delay, "acid", src) visible_message(SPAN_XENOWARNING("[src] vomits globs of vile stuff at [multitile_vehicle]. It sizzles under the bubbling mess of acid!"), \ SPAN_XENOWARNING("We vomit globs of vile stuff at [multitile_vehicle]. It sizzles under the bubbling mess of acid!"), null, 5) - playsound(O, "sound/bullets/acid_impact1.ogg", 25) + playsound(affected_atom, "sound/bullets/acid_impact1.ogg", 25) QDEL_IN(acid, 20) return @@ -135,7 +135,7 @@ visible_message(SPAN_XENOWARNING("[src] vomits globs of vile stuff all over [affected_atom]. It begins to sizzle and melt under the bubbling mess of acid!"), \ SPAN_XENOWARNING("We vomit globs of vile stuff all over [affected_atom]. It begins to sizzle and melt under the bubbling mess of acid!"), null, 5) - playsound(O, "sound/bullets/acid_impact1.ogg", 25) + playsound(affected_atom, "sound/bullets/acid_impact1.ogg", 25) /datum/action/xeno_action/activable/acider_for_the_hive/use_ability(atom/affected_atom)