Files
Bubberstation/code/modules/surgery/organs/ears.dm
RandolfTheMeh 48fbc073e5 [TMC] Defib Rework, Organ Damage Effects (#45104)
* Brain damage works on organ damage procs, some defib reworks

* Heart and Lung damaging effects and failure, liver damage and failure moved to its organ again

* Cleans up reused global

* Organ damage procs on living and living/carbon

* Changes brain damage procs again

* SR heals all organs on revive, no decay for cybernetic implants, stomach damage and fail effects.

* Damage and failure effects for the appendix, ears, and some touchups on the stomach

* Committing changes so I don't lose them

* Organs now cease decaying in the proper containers

* Organ Fridges

* Reverts map changes

* Adds coronary bypass, lobectomy, trying to deal with organ_stat runtime

* Actually fixes merge conflict

* Smartfridge tweaks

* Think I figured out map merger

* Evidently not

* Still runtiming with glass shards even after I remove the map changes?

* Fixes runtime error with brain_item

* Runtime fix on living/carbon/life

* Cleaning up old PR code

* Brain damage fix, moves defines to actually be in _DEFINES, under DNA since that's where organ slots were

* Wrong math operation used

* Brains in MMIs no longer decay

* Removes redundant variable, and defibs no longer work on heart attacks caused by failing hearts

* Removes misleading comment

* init freezes organs in case organ crates are added, morgue corpses are frozen, removes adjustLiverLoss

* Removes random spaces, scanners check brain damage severity now

* Swaps numbers for defines, fixes brain surgery, rebalances coronary bypass bleed since that was insane last I tested it

* List change

* Runs off of an index instead of using cut

* Brains can be put into organ fridges

* Fixes minor type, hotfix for cloning problem

* Removes pointless check

* Demon hearts no longer decay

* Nightmare hearts no longer decay

* Removes istype() check on process, sets can_decompose instead

* Condenses organ damage report

* Removes organ failure messages

* Less organ damage spam, implements organ threshold messages instead

* Brain damage messages go to owner, not source

* Self-examine shows damaged organs

* Minor code cleanup, adds autodoc comments to the new procs

* Inverts standard organ vars to prevent random organs decaying, adds a few more autodoc comments.

* Merged the booleans into a set of flags

* Healthy living improves organ healing rates

* dunno why this didn't update

* my actions have consequences

* Sets ORGAN_SYNTHETIC for overlooked robotics organs

* Doubles heart decay time

* 3 minute heart decay

* Lobectomy/Coronary_Bypass heal more

* removes hivemind spells from the changes
2019-07-29 02:18:22 -07:00

136 lines
4.3 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(!iscarbon(owner))
return
..()
var/mob/living/carbon/C = owner
if((damage < maxHealth) && (organ_flags & ORGAN_FAILING)) //ear damage can be repaired from the failing condition
organ_flags &= ~ORGAN_FAILING
// genetic deafness prevents the body from using the ears, even if healthy
if(HAS_TRAIT(C, TRAIT_DEAF))
deaf = max(deaf, 1)
else if(!(organ_flags & ORGAN_FAILING)) // if this organ is failing, do not clear deaf stacks.
deaf = max(deaf - 1, 0)
if(prob(damage / 20) && (damage > low_threshold))
adjustEarDamage(0, 4)
SEND_SOUND(C, sound('sound/weapons/flash_ring.ogg'))
to_chat(C, "<span class='warning'>The ringing in your ears grows louder, blocking out any external noises for a moment.</span>")
else if((organ_flags & ORGAN_FAILING) && (deaf == 0))
deaf = 1 //stop being not deaf you deaf idiot
/obj/item/organ/ears/proc/restoreEars()
deaf = 0
damage = 0
organ_flags &= ~ORGAN_FAILING
var/mob/living/carbon/C = owner
if(iscarbon(owner) && HAS_TRAIT(C, TRAIT_DEAF))
deaf = 1
/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/proc/minimumDeafTicks(value)
deaf = max(deaf, value)
/obj/item/organ/ears/invincible
damage_multiplier = 0
/mob/proc/restoreEars()
/mob/living/carbon/restoreEars()
var/obj/item/organ/ears/ears = getorgan(/obj/item/organ/ears)
if(ears)
ears.restoreEars()
/mob/proc/adjustEarDamage()
/mob/living/carbon/adjustEarDamage(ddmg, ddeaf)
var/obj/item/organ/ears/ears = getorgan(/obj/item/organ/ears)
if(ears)
ears.adjustEarDamage(ddmg, ddeaf)
/mob/proc/minimumDeafTicks()
/mob/living/carbon/minimumDeafTicks(value)
var/obj/item/organ/ears/ears = getorgan(/obj/item/organ/ears)
if(ears)
ears.minimumDeafTicks(value)
/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."
var/datum/component/waddle
/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>")
waddle = H.AddComponent(/datum/component/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>")
QDEL_NULL(waddle)
/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.