Files
Bubberstation/code/datums/components/earprotection.dm
Ghom 922bd0cb92 Refactor get_ear_protection() and soundbang_act() to be less bs (#93472)
so, the current `COMSIG_CARBON_SOUNDBANG` signal is kinda lame because:
1) it's relegated to carbon mobs
2) it means ear protection equipment actually has no effect when
`get_ear_protection` is called instead.
3) It's sent in more than one place in the code

So I replaced it with another signal, this one properly sent in
`get_ear_protection`, and therefore `soundbang_act` as well.

What's also lame is that the code for both `get_ear_protection` and
`soundbang_act` can be easily moved to the living type, and it wouldn't
make a huge impact aside causing simple mobs to be stunned very briefly
by flashbangs since they cannot be knocked down anyway. The less the
code is specific to a subtype, the easier it's to work with, the fewer
the paradigms etc.

Another lame thing is some of the code being kinda old. Also I wanted to
fix an issue with the shriek ling ability detailed in #93401. I wanted
to make the ability more consistent with how other sound-related
abilities work by making it use `soundbang_act`, but with an intensity
higher than any other feature so far, beside point-blank flashbangs
(holding on standing on one). I've also buffed the "ear protection"
offered by vacuums from 1 to 3, meaning nothing but point-blank
flashbangs will go through. Yes, this means shrieks are not good in a
vacuum because sound generally propagate in absence of molecules that
can transmit the vibration... at least IRL. The game's an approximation
anyway, but it's still inconsistent, like a fuckton of other things that
are even more outside of the scope of this PR. Well, at least it affects
simple/basic mobs too now.

## Why It's Good For The Game
This will fix #93401 and make some code less old and bad.

## Changelog

🆑
refactor: refactored code for ear/soundbang protection. Flashbangs and
other things can now affect simple/basic mobs as well, not just carbon
and occasionally silicons.
balance: Aliens are no longer impervious to soundbang_act. Still very
resistant to it due to their hardcoded ear protection
balance: How the resonant shriek changeling ability works is now
slightly more consistent with the ear/soundbang protection, meaning it
won't work well in a vacuum, but at least it works on simple mobs now.
fix: Everyone can now hear a changeling shriek, unless they're already
deafened or in a vacuum.
/🆑
2025-11-04 15:22:33 -05:00

15 lines
511 B
Plaintext

/datum/component/wearertargeting/earprotection
signals = list(COMSIG_LIVING_GET_EAR_PROTECTION)
mobtype = /mob/living/carbon
proctype = PROC_REF(reducebang)
var/reduce_amount = 1
valid_slots = ITEM_SLOT_EARS | ITEM_SLOT_HEAD
/datum/component/wearertargeting/earprotection/Initialize(reduce_amount = 1)
. = ..()
if(reduce_amount)
src.reduce_amount = reduce_amount
/datum/component/wearertargeting/earprotection/proc/reducebang(datum/source, list/reflist)
reflist[EAR_PROTECTION_ARG] -= reduce_amount