Merge pull request #10057 from Ghommie/Ghommie-cit431

fixes on_mob eyes overlays not updating properly in certain cases.
This commit is contained in:
Lin
2019-12-07 21:49:18 +00:00
committed by GitHub
4 changed files with 27 additions and 17 deletions
+18 -13
View File
@@ -31,18 +31,21 @@
var/damaged = FALSE //damaged indicates that our eyes are undergoing some level of negative effect
/obj/item/organ/eyes/Insert(mob/living/carbon/M, special = FALSE, drop_if_replaced = FALSE)
..()
. = ..()
if(!.)
return
if(damage == initial(damage))
clear_eye_trauma()
if(ishuman(owner))
var/mob/living/carbon/human/HMN = owner
old_eye_color = HMN.eye_color
var/mob/living/carbon/human/H = owner
old_eye_color = H.eye_color
if(eye_color)
HMN.eye_color = eye_color
HMN.regenerate_icons()
H.eye_color = eye_color
else
eye_color = HMN.eye_color
if(HAS_TRAIT(HMN, TRAIT_NIGHT_VISION) && !lighting_alpha)
eye_color = H.eye_color
if(!special)
H.dna?.species?.handle_body() //regenerate eyeballs overlays.
if(HAS_TRAIT(H, TRAIT_NIGHT_VISION) && !lighting_alpha)
lighting_alpha = LIGHTING_PLANE_ALPHA_NV_TRAIT
see_in_dark = 8
M.update_tint()
@@ -51,13 +54,15 @@
/obj/item/organ/eyes/Remove(mob/living/carbon/M, special = 0)
clear_eye_trauma()
..()
. = ..()
if(ishuman(M) && eye_color)
var/mob/living/carbon/human/HMN = M
HMN.eye_color = old_eye_color
HMN.regenerate_icons()
M.update_tint()
M.update_sight()
var/mob/living/carbon/human/H = M
H.eye_color = old_eye_color
if(!special)
H.dna.species.handle_body()
if(!special)
M.update_tint()
M.update_sight()
/obj/item/organ/eyes/on_life()
..()