Readability & Abstraction Improvements + A Tweak

As per Tigercat's review, readability has been improved and the method
by which eyeshine is applied has been abstracted a lot more.

As part of that, I have divised a solution for the situation where,
prior to this tweak, if you were a Tajara and had the 'bangs' hairstyle
while also having eyeshine, one of your eyes would render ABOVE your
hair.

Now, despite the eye shine happening on a higher layer, the eye that
would ordinarily be hidden by the hair still is.
How? By cutting the pixels that are overlapped by the hair from the eye
icon during rendering.
This commit is contained in:
KasparoVy
2018-02-09 20:12:31 -05:00
parent 64ced9f6b6
commit 541b4f7275
6 changed files with 52 additions and 13 deletions
+17 -6
View File
@@ -305,12 +305,23 @@
/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/generate_icon(var/mob/living/carbon/human/HA)
var/mob/living/carbon/human/H = HA
if(!istype(H))
H = owner
var/icon/eyes_icon = new /icon('icons/mob/human_face.dmi', H.species.eyes)
eyes_icon.Blend(eye_colour, ICON_ADD)
return eyes_icon
/obj/item/organ/internal/eyes/proc/get_eye_shine(var/mob/living/carbon/human/HA) //Referenced cult constructs for shining in the dark. Needs to be above lighting effects such as shading.
var/mob/living/carbon/human/H = HA
if(!istype(H))
H = owner
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
var/datum/sprite_accessory/hair/hair_style = hair_styles_full_list[head_organ.h_style]
var/icon/hair = new /icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
return image(get_icon_difference(generate_icon(H), hair), layer = LIGHTING_LAYER + 1) //Cut the hair's pixels from the eyes icon so eyes covered by bangs stay hidden even while on a higher layer.
/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)