[MIRROR] Audio falloff re-work, and increased audio range. (#1406)

* Audio falloff re-work, and increased audio range.

* a

* a

Co-authored-by: Qustinnus <Floydje123@hotmail.com>
Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
SkyratBot
2020-10-21 07:36:31 +02:00
committed by GitHub
co-authored by Qustinnus Azarak
parent b9fe7a0402
commit d1315d9474
74 changed files with 204 additions and 134 deletions
+1 -1
View File
@@ -167,5 +167,5 @@
/datum/fantasy_affix/fool/apply(datum/component/fantasy/comp, newName)
. = ..()
var/obj/item/master = comp.parent
comp.appliedComponents += master.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 50)
comp.appliedComponents += master.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 50, falloff_exponent = 20)
return "[newName] of the fool"
+7 -7
View File
@@ -11,7 +11,7 @@
///This can be a list OR a soundfile OR null. Determines whatever sound gets played.
var/footstep_sounds
/datum/component/footstep/Initialize(footstep_type_ = FOOTSTEP_MOB_BAREFOOT, volume_ = 0.5, e_range_ = -1)
/datum/component/footstep/Initialize(footstep_type_ = FOOTSTEP_MOB_BAREFOOT, volume_ = 0.5, e_range_ = -8)
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
volume = volume_
@@ -47,7 +47,7 @@
return
if(LM.body_position == LYING_DOWN) //play crawling sound if we're lying
playsound(T, 'sound/effects/footstep/crawl1.ogg', 15 * volume)
playsound(T, 'sound/effects/footstep/crawl1.ogg', 15 * volume, falloff_distance = 1)
return
if(iscarbon(LM))
@@ -75,7 +75,7 @@
if(!T)
return
if(isfile(footstep_sounds) || istext(footstep_sounds))
playsound(T, footstep_sounds, volume)
playsound(T, footstep_sounds, volume, falloff_distance = 1)
return
var/turf_footstep
switch(footstep_type)
@@ -89,7 +89,7 @@
turf_footstep = T.footstep
if(!turf_footstep)
return
playsound(T, pick(footstep_sounds[turf_footstep][1]), footstep_sounds[turf_footstep][2] * volume, TRUE, footstep_sounds[turf_footstep][3] + e_range)
playsound(T, pick(footstep_sounds[turf_footstep][1]), footstep_sounds[turf_footstep][2] * volume, TRUE, footstep_sounds[turf_footstep][3] + e_range, falloff_distance = 1)
/datum/component/footstep/proc/play_humanstep()
SIGNAL_HANDLER
@@ -106,12 +106,12 @@
playsound(T, pick(GLOB.footstep[T.footstep][1]),
GLOB.footstep[T.footstep][2] * volume,
TRUE,
GLOB.footstep[T.footstep][3] + e_range)
GLOB.footstep[T.footstep][3] + e_range, falloff_distance = 1)
else
if(H.dna.species.special_step_sounds)
playsound(T, pick(H.dna.species.special_step_sounds), 50, TRUE)
playsound(T, pick(H.dna.species.special_step_sounds), 50, TRUE, falloff_distance = 1)
else
playsound(T, pick(GLOB.barefootstep[T.barefootstep][1]),
GLOB.barefootstep[T.barefootstep][2] * volume,
TRUE,
GLOB.barefootstep[T.barefootstep][3] + e_range)
GLOB.barefootstep[T.barefootstep][3] + e_range, falloff_distance = 1)
+16 -3
View File
@@ -13,7 +13,14 @@
var/last_use = 0
var/use_delay = 20
/datum/component/squeak/Initialize(custom_sounds, volume_override, chance_override, step_delay_override, use_delay_override)
///extra-range for this component's sound
var/sound_extra_range = -1
///when sounds start falling off for the squeak
var/sound_falloff_distance = SOUND_DEFAULT_FALLOFF_DISTANCE
///sound exponent for squeak. Defaults to 10 as squeaking is loud and annoying enough.
var/sound_falloff_exponent = 10
/datum/component/squeak/Initialize(custom_sounds, volume_override, chance_override, step_delay_override, use_delay_override, extrarange, falloff_exponent, fallof_distance)
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_BLOB_ACT, COMSIG_ATOM_HULK_ATTACK, COMSIG_PARENT_ATTACKBY), .proc/play_squeak)
@@ -41,15 +48,21 @@
step_delay = step_delay_override
if(isnum(use_delay_override))
use_delay = use_delay_override
if(isnum(extrarange))
sound_extra_range = extrarange
if(isnum(falloff_exponent))
sound_falloff_exponent = falloff_exponent
if(isnum(fallof_distance))
sound_falloff_distance = fallof_distance
/datum/component/squeak/proc/play_squeak()
SIGNAL_HANDLER
if(prob(squeak_chance))
if(!override_squeak_sounds)
playsound(parent, pickweight(default_squeak_sounds), volume, TRUE, -1)
playsound(parent, pickweight(default_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
else
playsound(parent, pickweight(override_squeak_sounds), volume, TRUE, -1)
playsound(parent, pickweight(override_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
/datum/component/squeak/proc/step_squeak()
SIGNAL_HANDLER
+2 -2
View File
@@ -412,7 +412,7 @@
user.adjustBruteLoss(30)
user.Unconscious(100)
user.gain_trauma_type(BRAIN_TRAUMA_MILD)
user.playsound_local(get_turf(user), 'sound/weapons/flashbang.ogg', 100, TRUE, 8, 0.9)
user.playsound_local(get_turf(user), 'sound/weapons/flashbang.ogg', 100, TRUE, 8)
shake_camera(user, 6, 6)
user.overlay_fullscreen("flash", /obj/screen/fullscreen/flash)
user.clear_fullscreen("flash", 3.5)
@@ -424,7 +424,7 @@
user.add_confusion(15)
if(prob(80))
user.gain_trauma(/datum/brain_trauma/mild/concussion)
user.playsound_local(get_turf(user), 'sound/weapons/flashbang.ogg', 100, TRUE, 8, 0.9)
user.playsound_local(get_turf(user), 'sound/weapons/flashbang.ogg', 100, TRUE, 8)
user.Knockdown(40)
shake_camera(user, 5, 5)
user.overlay_fullscreen("flash", /obj/screen/fullscreen/flash)