mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 05:23:22 +01:00
Tweaked the sounds to dampen the volume (#18773)
Tweaked the sounds to dampen the volume depending on what is present between the source and the destination, accounts for walls/doors/windows Testmerge as I am not sure how expensive doing this would be Based on feedback and inputs from Read
This commit is contained in:
+35
-1
@@ -107,9 +107,43 @@
|
||||
|
||||
for(var/mob/listening_mob in listeners | dead_players_by_zlevel[source_z])//observers always hear through walls
|
||||
if(get_dist(listening_mob, turf_source) <= maxdistance)
|
||||
listening_mob.playsound_local(turf_source, soundin, vol, vary, frequency, falloff_exponent, channel, pressure_affected, S, maxdistance, falloff_distance, 1, use_reverb)
|
||||
//Aurora snowflake, if we don't ignore the walls, account for wall-like obstacles to dampen the sound
|
||||
if(ignore_walls)
|
||||
listening_mob.playsound_local(turf_source, soundin, vol, vary, frequency, falloff_exponent, channel, pressure_affected, S, maxdistance, falloff_distance, 1, use_reverb)
|
||||
else
|
||||
adjust_sound_based_on_path_obstacles(listening_mob, turf_source, soundin, vol, vary, frequency, falloff_exponent, channel, pressure_affected, S, maxdistance, falloff_distance, use_reverb)
|
||||
|
||||
. += listening_mob
|
||||
|
||||
/**
|
||||
* This proc takes into account walls, windows and similar when deciding the received sound for a mob,
|
||||
*
|
||||
* this is *NOT* meant to be called directly, use `playsound()`
|
||||
*
|
||||
* Use this to tweak what happens with the sound along the path from the emitter to the receiver of said sound
|
||||
*/
|
||||
/proc/adjust_sound_based_on_path_obstacles(mob/listening_mob, turf/turf_source, soundin, vol, vary, frequency, falloff_exponent, channel, pressure_affected, S, maxdistance, falloff_distance, use_reverb)
|
||||
var/turf/inbetween_turf = get_turf(listening_mob)
|
||||
|
||||
for(var/step_counter in 1 to get_dist(listening_mob, turf_source))
|
||||
inbetween_turf = get_step_towards(inbetween_turf, turf_source)
|
||||
|
||||
if(istype(inbetween_turf, /turf/simulated/wall))
|
||||
vol *= 0.6
|
||||
|
||||
if(locate(/obj/machinery/door) in inbetween_turf)
|
||||
vol *= 0.7
|
||||
|
||||
if(locate(/obj/structure/window) in inbetween_turf)
|
||||
vol *= 0.75
|
||||
|
||||
//If we're at or below zero, no point continuing, no sound
|
||||
if(vol <= 0)
|
||||
return
|
||||
|
||||
listening_mob.playsound_local(turf_source, soundin, vol, vary, frequency, falloff_exponent, channel, pressure_affected, S, maxdistance, falloff_distance, 1, use_reverb)
|
||||
|
||||
|
||||
/mob/proc/playsound_local(turf/turf_source, soundin, vol as num, vary, frequency, falloff_exponent = SOUND_FALLOFF_EXPONENT, channel = 0, pressure_affected = TRUE, sound/sound_to_use, max_distance, falloff_distance = SOUND_DEFAULT_FALLOFF_DISTANCE, distance_multiplier = 1, use_reverb = TRUE)
|
||||
if(!client || !can_hear())
|
||||
return
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
################################
|
||||
# Example Changelog File
|
||||
#
|
||||
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||
#
|
||||
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||
# When it is, any changes listed below will disappear.
|
||||
#
|
||||
# Valid Prefixes:
|
||||
# bugfix
|
||||
# wip (For works in progress)
|
||||
# tweak
|
||||
# soundadd
|
||||
# sounddel
|
||||
# rscadd (general adding of nice things)
|
||||
# rscdel (general deleting of nice things)
|
||||
# imageadd
|
||||
# imagedel
|
||||
# maptweak
|
||||
# spellcheck (typo fixes)
|
||||
# experiment
|
||||
# balance
|
||||
# admin
|
||||
# backend
|
||||
# security
|
||||
# refactor
|
||||
#################################
|
||||
|
||||
# Your name.
|
||||
author: FluffyGhost, ReadThisNamePlz
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
|
||||
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- backend: "Tweaked the sounds to dampen the volume depending on what is present between the source and the destination, accounts for walls/doors/windows."
|
||||
Reference in New Issue
Block a user