Replaces HEALS_EARS_2 with a component, adds a wearertargeting parent component for future use (#37530)

code: HEALS_EARS_2 is removed in favor of the earhealing component

code: wearertargeting component is available to subtype for components that want to target the wearer of an item rather than the item itself
This commit is contained in:
vuonojenmustaturska
2018-04-30 10:32:59 +12:00
committed by oranges
parent 7ebb00abef
commit 3eb30b16f3
8 changed files with 67 additions and 14 deletions
+5 -1
View File
@@ -15,7 +15,11 @@
strip_delay = 15
equip_delay_other = 25
resistance_flags = FLAMMABLE
flags_2 = BANG_PROTECT_2|HEALS_EARS_2
flags_2 = BANG_PROTECT_2
/obj/item/clothing/ears/earmuffs/ComponentInitialize()
. = ..()
AddComponent(/datum/component/earhealing)
/obj/item/clothing/ears/headphones
name = "headphones"
+3 -8
View File
@@ -27,14 +27,9 @@
// genetic deafness prevents the body from using the ears, even if healthy
if(C.has_trait(TRAIT_DEAF))
deaf = max(deaf, 1)
else
if(C.ears && (C.ears.flags_2 & HEALS_EARS_2))
deaf = max(deaf - 1, 1)
ear_damage = max(ear_damage - 0.1, 0)
// if higher than UNHEALING_EAR_DAMAGE, no natural healing occurs.
if(ear_damage < UNHEALING_EAR_DAMAGE)
ear_damage = max(ear_damage - 0.05, 0)
deaf = max(deaf - 1, 0)
else if(ear_damage < UNHEALING_EAR_DAMAGE) // if higher than UNHEALING_EAR_DAMAGE, no natural healing occurs.
ear_damage = max(ear_damage - 0.05, 0)
deaf = max(deaf - 1, 0)
/obj/item/organ/ears/proc/restoreEars()
deaf = 0