Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Git-Nivrak committed Jul 1, 2024
1 parent 0b735b5 commit a5b6251
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
31 changes: 28 additions & 3 deletions code/datums/soundOutput.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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)

Expand Down Expand Up @@ -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)

Check failure on line 107 in code/datums/soundOutput.dm

View workflow job for this annotation

GitHub Actions / Run Linters

bad input type: '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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit a5b6251

Please sign in to comment.