20fd4822f2
About The Pull Request Ears currently behave strangely compared to other organs, especially their most closely related sensory organ, eyes. They only assign a deafness trait for quirks, mutations, and clothing (which prevents empaths from noticing hearing damage deafness), have lots of unnecessary procs for dealing/assessing damage, and several audible events check istype() for earmuffs specifically for whether a mob can hear something. This cuts down on all of that. I removed most ear related procs from mobs, tied deafness explicitly to TRAIT_DEAF (and added a new source for hearing damage), and generally neatened up related code. As a direct result, empaths can now detect deafness from hearing damage, as I assume was intended. I also fixed a bug with examining with med HUD's or as an observer not showing a person's quirks, though I'm not sure people will really care about the info with med HUDs. Also, full revives/regenerating organs now remove all damage from existing organs rather than only trying to replace missing ones In addition, Inacusiate and Sensory Restoration no longer instantly cure all hearing damage when applied, they now rapidly decrease both ear damage and deafness each tick. This isn't really a fix, but I figured I'd throw it in since I think cobby wanted to move away from instant fix microdose chems, and I punted the restoreEars() procs anyway Fixes: #51435 Fixes: #48974 Why It's Good For The Game Brings ears in line with how other organs operate, makes them easier to understand, and restores (what I assume to be) intended functionality for the empath quirk and medhud/observer examines Changelog cl Ryll/Shaps fix: Empaths are able to detect deafness derived from hearing damage tweak: Inacusiate and Sensory Restoration no longer instantly heal all hearing damage when applied, instead rapidly removing both ear damage and deafness. fix: MedHUDs and observers now display quirks as intended on examine /cl
122 lines
4.1 KiB
Plaintext
122 lines
4.1 KiB
Plaintext
/obj/item/organ/ears
|
|
name = "ears"
|
|
icon_state = "ears"
|
|
desc = "There are three parts to the ear. Inner, middle and outer. Only one of these parts should be normally visible."
|
|
zone = BODY_ZONE_HEAD
|
|
slot = ORGAN_SLOT_EARS
|
|
gender = PLURAL
|
|
|
|
healing_factor = STANDARD_ORGAN_HEALING
|
|
decay_factor = STANDARD_ORGAN_DECAY
|
|
|
|
low_threshold_passed = "<span class='info'>Your ears begin to resonate with an internal ring sometimes.</span>"
|
|
now_failing = "<span class='warning'>You are unable to hear at all!</span>"
|
|
now_fixed = "<span class='info'>Noise slowly begins filling your ears once more.</span>"
|
|
low_threshold_cleared = "<span class='info'>The ringing in your ears has died down.</span>"
|
|
|
|
// `deaf` measures "ticks" of deafness. While > 0, the person is unable
|
|
// to hear anything.
|
|
var/deaf = 0
|
|
|
|
// `damage` in this case measures long term damage to the ears, if too high,
|
|
// the person will not have either `deaf` or `ear_damage` decrease
|
|
// without external aid (earmuffs, drugs)
|
|
|
|
//Resistance against loud noises
|
|
var/bang_protect = 0
|
|
// Multiplier for both long term and short term ear damage
|
|
var/damage_multiplier = 1
|
|
|
|
/obj/item/organ/ears/on_life()
|
|
. = ..()
|
|
// if we have non-damage related deafness like mutations, quirks or clothing (earmuffs), don't bother processing here. Ear healing from earmuffs or chems happen elsewhere
|
|
if(HAS_TRAIT_NOT_FROM(owner, TRAIT_DEAF, EAR_DAMAGE))
|
|
return
|
|
|
|
if((damage < maxHealth) && (organ_flags & ORGAN_FAILING)) //ear damage can be repaired from the failing condition
|
|
organ_flags &= ~ORGAN_FAILING
|
|
|
|
if((organ_flags & ORGAN_FAILING))
|
|
deaf = max(deaf, 1) // if we're failing we always have at least 1 deaf stack (and thus deafness)
|
|
else // only clear deaf stacks if we're not failing
|
|
deaf = max(deaf - 1, 0)
|
|
if((damage > low_threshold) && prob(damage / 30))
|
|
adjustEarDamage(0, 4)
|
|
SEND_SOUND(owner, sound('sound/weapons/flash_ring.ogg'))
|
|
to_chat(owner, "<span class='warning'>The ringing in your ears grows louder, blocking out any external noises for a moment.</span>")
|
|
|
|
if(deaf)
|
|
ADD_TRAIT(owner, TRAIT_DEAF, EAR_DAMAGE)
|
|
else
|
|
REMOVE_TRAIT(owner, TRAIT_DEAF, EAR_DAMAGE)
|
|
|
|
/obj/item/organ/ears/proc/adjustEarDamage(ddmg, ddeaf)
|
|
damage = max(damage + (ddmg*damage_multiplier), 0)
|
|
deaf = max(deaf + (ddeaf*damage_multiplier), 0)
|
|
|
|
/obj/item/organ/ears/invincible
|
|
damage_multiplier = 0
|
|
|
|
/obj/item/organ/ears/cat
|
|
name = "cat ears"
|
|
icon = 'icons/obj/clothing/hats.dmi'
|
|
icon_state = "kitty"
|
|
damage_multiplier = 2
|
|
|
|
/obj/item/organ/ears/cat/Insert(mob/living/carbon/human/H, special = 0, drop_if_replaced = TRUE)
|
|
..()
|
|
if(istype(H))
|
|
color = H.hair_color
|
|
H.dna.species.mutant_bodyparts |= "ears"
|
|
H.dna.features["ears"] = "Cat"
|
|
H.update_body()
|
|
|
|
/obj/item/organ/ears/cat/Remove(mob/living/carbon/human/H, special = 0)
|
|
..()
|
|
if(istype(H))
|
|
color = H.hair_color
|
|
H.dna.features["ears"] = "None"
|
|
H.dna.species.mutant_bodyparts -= "ears"
|
|
H.update_body()
|
|
|
|
/obj/item/organ/ears/penguin
|
|
name = "penguin ears"
|
|
desc = "The source of a penguin's happy feet."
|
|
|
|
/obj/item/organ/ears/penguin/Insert(mob/living/carbon/human/H, special = 0, drop_if_replaced = TRUE)
|
|
. = ..()
|
|
if(istype(H))
|
|
to_chat(H, "<span class='notice'>You suddenly feel like you've lost your balance.</span>")
|
|
H.AddElement(/datum/element/waddling)
|
|
|
|
/obj/item/organ/ears/penguin/Remove(mob/living/carbon/human/H, special = 0)
|
|
. = ..()
|
|
if(istype(H))
|
|
to_chat(H, "<span class='notice'>Your sense of balance comes back to you.</span>")
|
|
H.RemoveElement(/datum/element/waddling)
|
|
|
|
/obj/item/organ/ears/bronze
|
|
name = "tin ears"
|
|
desc = "The robust ears of a bronze golem. "
|
|
damage_multiplier = 0.1 //STRONK
|
|
bang_protect = 1 //Fear me weaklings.
|
|
|
|
/obj/item/organ/ears/cybernetic
|
|
name = "cybernetic ears"
|
|
icon_state = "ears-c"
|
|
desc = "a basic cybernetic designed to mimic the operation of ears."
|
|
damage_multiplier = 0.9
|
|
organ_flags = ORGAN_SYNTHETIC
|
|
|
|
/obj/item/organ/ears/cybernetic/upgraded
|
|
name = "upgraded cybernetic ears"
|
|
icon_state = "ears-c-u"
|
|
desc = "an advanced cybernetic ear, surpassing the performance of organic ears"
|
|
damage_multiplier = 0.5
|
|
|
|
/obj/item/organ/ears/cybernetic/emp_act(severity)
|
|
. = ..()
|
|
if(. & EMP_PROTECT_SELF)
|
|
return
|
|
damage += 40/severity
|