Immursive Audio 2
This commit is contained in:
@@ -87,7 +87,7 @@
|
||||
else
|
||||
to_chat(source, self_message)
|
||||
if(playsound)
|
||||
source.playsound_local(source, 'sound/misc/ui_toggle.ogg', 50, FALSE, pressure_affected = FALSE) //Sound from interbay!
|
||||
source.playsound_local(source, 'sound/misc/ui_toggle.ogg', 50, FALSE, pressure_affected = FALSE, use_reverb= FALSE) //Sound from interbay!
|
||||
RegisterSignal(source, COMSIG_MOB_CLIENT_MOUSEMOVE, .proc/onMouseMove)
|
||||
RegisterSignal(source, COMSIG_MOVABLE_MOVED, .proc/on_move)
|
||||
RegisterSignal(source, COMSIG_MOB_CLIENT_MOVE, .proc/on_client_move)
|
||||
@@ -114,7 +114,7 @@
|
||||
else
|
||||
to_chat(source, self_message)
|
||||
if(playsound)
|
||||
source.playsound_local(source, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE) //Slightly modified version of the toggleon sound!
|
||||
source.playsound_local(source, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE, use_reverb= FALSE) //Slightly modified version of the toggleon sound!
|
||||
UnregisterSignal(source, list(COMSIG_MOB_CLIENT_MOUSEMOVE, COMSIG_MOVABLE_MOVED, COMSIG_MOB_CLIENT_MOVE))
|
||||
if(hud_icon)
|
||||
hud_icon.combat_on = FALSE
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
var/mob/living/LM = parent
|
||||
if(!T.footstep || LM.buckled || !CHECK_MOBILITY(LM, MOBILITY_STAND) || LM.buckled || LM.throwing || (LM.movement_type & (VENTCRAWLING | FLYING)))
|
||||
if (LM.lying && !LM.buckled && !(!T.footstep || LM.movement_type & (VENTCRAWLING | FLYING))) //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(HAS_TRAIT(LM, TRAIT_SILENT_STEP))
|
||||
@@ -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()
|
||||
var/turf/open/T = prepare_step()
|
||||
@@ -114,10 +114,10 @@
|
||||
turf_footstep = T.footstep
|
||||
L = GLOB.footstep
|
||||
if(FOOTSTEP_MOB_SLIME)
|
||||
playsound(T, 'sound/effects/footstep/slime1.ogg', 50 * volume)
|
||||
playsound(T, 'sound/effects/footstep/slime1.ogg', 50 * volume, falloff_distance = 1)
|
||||
return
|
||||
if(FOOTSTEP_MOB_CRAWL)
|
||||
playsound(T, 'sound/effects/footstep/crawl1.ogg', 50 * volume)
|
||||
playsound(T, 'sound/effects/footstep/crawl1.ogg', 50 * volume, falloff_distance = 1)
|
||||
return
|
||||
special = TRUE
|
||||
else
|
||||
@@ -126,13 +126,13 @@
|
||||
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)
|
||||
return
|
||||
|
||||
if(!special && 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(L[turf_footstep][1]),
|
||||
L[turf_footstep][2] * volume,
|
||||
TRUE,
|
||||
L[turf_footstep][3] + e_range)
|
||||
L[turf_footstep][3] + e_range, falloff_distance = 1)
|
||||
|
||||
@@ -19,7 +19,14 @@
|
||||
/// chance we'll be stopped from squeaking by cooldown when something crossing us squeaks
|
||||
var/cross_squeak_delay_chance = 33 // about 3 things can squeak at a time
|
||||
|
||||
/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)
|
||||
@@ -45,6 +52,12 @@
|
||||
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/UnregisterFromParent()
|
||||
if(!isatom(parent))
|
||||
@@ -62,42 +75,42 @@
|
||||
return ..()
|
||||
|
||||
/datum/component/squeak/proc/play_squeak()
|
||||
do_play_squeak()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
|
||||
/datum/component/squeak/proc/do_play_squeak(bypass_cooldown = FALSE)
|
||||
if(!bypass_cooldown && ((last_squeak + squeak_delay) >= world.time))
|
||||
return FALSE
|
||||
if(prob(squeak_chance))
|
||||
if(!override_squeak_sounds)
|
||||
playsound(parent, pickweight(default_squeak_sounds), volume, 1, -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, 1, -1)
|
||||
last_squeak = world.time
|
||||
playsound(parent, pickweight(override_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/component/squeak/proc/step_squeak()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(steps > step_delay)
|
||||
do_play_squeak(TRUE)
|
||||
play_squeak()
|
||||
steps = 0
|
||||
else
|
||||
steps++
|
||||
|
||||
/datum/component/squeak/proc/play_squeak_crossed(datum/source, atom/movable/AM)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(isitem(AM))
|
||||
var/obj/item/I = AM
|
||||
if(I.item_flags & ABSTRACT)
|
||||
return
|
||||
else if(istype(AM, /obj/item/projectile))
|
||||
var/obj/item/projectile/P = AM
|
||||
if(P.original != parent)
|
||||
return
|
||||
if(AM.movement_type & (FLYING|FLOATING) || !AM.has_gravity())
|
||||
return
|
||||
var/atom/current_parent = parent
|
||||
if(isturf(current_parent.loc))
|
||||
if(do_play_squeak())
|
||||
if(play_squeak())
|
||||
SEND_SIGNAL(AM, COMSIG_CROSS_SQUEAKED)
|
||||
|
||||
/datum/component/squeak/proc/use_squeak()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(last_use + use_delay < world.time)
|
||||
last_use = world.time
|
||||
play_squeak()
|
||||
@@ -118,6 +131,8 @@
|
||||
RegisterSignal(holder, COMSIG_ATOM_DIR_CHANGE, .proc/holder_dir_change)
|
||||
|
||||
/datum/component/squeak/proc/holder_dir_change(datum/source, old_dir, new_dir)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
//If the dir changes it means we're going through a bend in the pipes, let's pretend we bumped the wall
|
||||
if(old_dir != new_dir)
|
||||
play_squeak()
|
||||
|
||||
Reference in New Issue
Block a user