Files
Bubberstation/code/datums/elements/squish_sound.dm
SkyratBot 876357d6a5 [MIRROR] Revenants no longer make noise walking into gibs (#26500)
* Revenants no longer make noise walking into gibs (#81420)

## About The Pull Request

Turns the hardcoded sound that plays when you walk into some gibs into
an Element and adds a check for flying to avoid playing the sound,
fixing Revenants, Holoparasites, and other mobs that fly from making
noise when "walking" into a pool of blood.

## Why It's Good For The Game

I was observing a revenant and heard them making noise from walking over
blood, thought it was kinda f*cked up

## Changelog

🆑
fix: Revenants (and other flying mobs) will not make noise when walking
into pools of gibs,
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@ users.noreply.github.com>

* Revenants no longer make noise walking into gibs

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@ users.noreply.github.com>
2024-02-14 06:26:40 -05:00

28 lines
927 B
Plaintext

///Plays a sound when walked into, lower sounding if the person walking into it has light stepping.
/datum/element/squish_sound
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
///The sound to play when something holding this element is entered.
var/sound_to_play
/datum/element/squish_sound/Attach(
datum/target,
sound = 'sound/effects/footstep/gib_step.ogg',
)
. = ..()
sound_to_play = sound
RegisterSignal(target, COMSIG_MOVABLE_CROSS, PROC_REF(on_cross))
///Plays the set sound upon being entered, as long as the person walking into it can actually walk.
/datum/element/squish_sound/proc/on_cross(atom/movable/source, atom/movable/crossed)
SIGNAL_HANDLER
if(!isliving(crossed) || (crossed.movement_type & MOVETYPES_NOT_TOUCHING_GROUND) || crossed.throwing)
return
playsound(
source = source,
soundin = sound_to_play,
vol = HAS_TRAIT(crossed, TRAIT_LIGHT_STEP) ? 20 : 50,
vary = TRUE,
)