Skip to content

Commit

Permalink
Added Ability for Looping Sounds to be heard from further away. (#4857)
Browse files Browse the repository at this point in the history
# Allows Looping Sounds to be heard from further away. 

# Explain why it's good for the game
allows for looping alarms to be proximity based and heard from more than
1 room away should one desire.



side note... I was eating pizza and there was hella black ash on the
bottom. I think they burned garlic bread. It was nasty.


# Testing Photographs and Procedure
screenshot a sound? 

okay uhh... I uhh... adjusted settings and played a looping sound and
walked away from it.
:cl:
code: Added ability to have looping sounds from further away
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
hislittlecuzingames and Drulikar authored Nov 20, 2023
1 parent 47bac60 commit 986d66f
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions code/datums/looping_sounds/_looping_sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
/// Has the looping started yet?
var/loop_started = FALSE

/**
* Let's you make a "loud" sound that "projects." IE you can hear this sound from a further distance away.
* Think of like an air raid siren. They're loud if you're close yeah... but you can hear them from mad far away, bruv
* with a longer "falloff distance." Fixes the extra_range stuff
*/
var/is_sound_projecting = FALSE
///only applicable to is_sound_projecting: max range till sound volume starts dropping as distance increases
var/falloff_distance = 50

/* // as of yet unused varen \\
/// How much the sound will be affected by falloff per tile.
Expand Down Expand Up @@ -130,19 +139,18 @@
sound_to_play.channel = get_free_channel()
sound_to_play.volume = volume_override || volume //Use volume as fallback if theres no override
SEND_SOUND(parent, sound_to_play)
else
playsound(
parent,
sound_to_play,
volume,
vary,
extra_range//,
// falloff_exponent = falloff_exponent,
// pressure_affected = pressure_affected,
// ignore_walls = ignore_walls,
// falloff_distance = falloff_distance,
// use_reverb = use_reverb
)
return
if (is_sound_projecting)
playsound(parent, sound_to_play, volume, vary, extra_range, VOLUME_SFX, 0, 0, falloff_distance)
return

playsound(
parent,
sound_to_play,
volume,
vary,
extra_range
)

/// Returns the sound we should now be playing.
/datum/looping_sound/proc/get_sound(_mid_sounds)
Expand Down

0 comments on commit 986d66f

Please sign in to comment.