From 5053b2aa74e81a897ae0729b0d4a4d0b2a4e120f Mon Sep 17 00:00:00 2001 From: KasparoVy Date: Fri, 29 Dec 2017 00:59:41 -0500 Subject: [PATCH] Adds "Eye-Glow" for Humanoids w/ High Darksight or XRAY Vision --- code/modules/mob/living/carbon/human/human.dm | 7 +++++++ code/modules/mob/living/carbon/human/update_icons.dm | 1 + code/modules/surgery/organs/organ_icon.dm | 2 +- code/modules/surgery/organs/organ_internal.dm | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index dad8fae62f7..0f4f070a2f2 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1668,6 +1668,13 @@ G.icon_state = "grabbed1" G.synch() +/mob/living/carbon/human/proc/eyes_glow() /*Used to check if eyes should glow in the dark. Returns the image of the eyes on the layer where they will appear to glow. + Eyes need to have significantly high darksight to glow unless the mob has the XRAY vision mutation. Eyes will not glow if they are covered in any way.*/ + var/obj/item/organ/internal/eyes/eyes = get_int_organ(/obj/item/organ/internal/eyes) + var/const/glow_threshold = 6 + if(istype(eyes) && ((eyes.get_dark_view() > glow_threshold) || (XRAY in mutations)) && get_location_accessible(src, "eyes")) + return(image(eyes.generate_icon(), layer = LIGHTING_LAYER + 1)) //Referenced cult constructs for glowing in the dark. Needs to be above lighting effects such as shading. + /mob/living/carbon/human/proc/gut() set category = "Abilities" set name = "Gut" diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index e06edd7fcaf..7d763d2b028 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -160,6 +160,7 @@ Please contact me on #coderbus IRC. ~Carn x overlays += (new_overlays - old_overlays) overlays -= (old_overlays - new_overlays) cached_standing_overlays = new_overlays + overlays |= eyes_glow() //Only applies eyeglow if the eyes are uncovered and have significantly high darksight or XRAY vision. update_transform() diff --git a/code/modules/surgery/organs/organ_icon.dm b/code/modules/surgery/organs/organ_icon.dm index c0c7754eb0a..02031f5ca32 100644 --- a/code/modules/surgery/organs/organ_icon.dm +++ b/code/modules/surgery/organs/organ_icon.dm @@ -109,7 +109,7 @@ var/global/list/limb_icon_cache = list() if(eye_implant) // Eye implants override native DNA eye color eyes_icon.Blend(eye_implant.eye_colour, ICON_ADD) else if(eyes) - eyes_icon.Blend(eyes.eye_colour, ICON_ADD) + eyes_icon = eyes.generate_icon() else eyes_icon.Blend("#800000", ICON_ADD) mob_icon.Blend(eyes_icon, ICON_OVERLAY) diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index cefc03f5a1c..6114ae57ed1 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -305,6 +305,13 @@ /obj/item/organ/internal/eyes/proc/update_colour() dna.write_eyes_attributes(src) +/obj/item/organ/internal/eyes/proc/generate_icon(var/mob/living/carbon/human/H) + var/mob/living/carbon/human/G = H ? H : owner + if(istype(G)) + var/icon/eyes_icon = new/icon('icons/mob/human_face.dmi', G.species.eyes) + eyes_icon.Blend(eye_colour, ICON_ADD) + return(eyes_icon) + /obj/item/organ/internal/eyes/proc/get_colourmatrix() //Returns a special colour matrix if the eyes are organic and the mob is colourblind, otherwise it uses the current one. if(!robotic && owner.disabilities & COLOURBLIND) return colourblind_matrix