I figured there was a better way to do this.

Refactors eyecon generation and eye-shine.

Synthetic eyes and cyber-eye implants will now trigger eye-shine.
This commit is contained in:
KasparoVy
2018-02-09 23:52:50 -05:00
parent 541b4f7275
commit 8ef309eb87
7 changed files with 54 additions and 29 deletions
+12 -2
View File
@@ -18,6 +18,9 @@
/obj/item/organ/internal/cyberimp/eyes/insert(var/mob/living/carbon/M, var/special = 0)
..()
var/mob/living/carbon/human/H = M
if(istype(H) && eye_colour)
H.update_body() //Apply our eye colour to the target.
if(aug_message && !special)
to_chat(owner, "<span class='notice'>[aug_message]</span>")
M.update_sight()
@@ -26,6 +29,15 @@
. = ..()
M.update_sight()
/obj/item/organ/internal/cyberimp/eyes/proc/generate_icon(var/mob/living/carbon/human/HA)
var/mob/living/carbon/human/H = HA
if(!istype(H))
H = owner
var/icon/cybereyes_icon = new /icon('icons/mob/human_face.dmi', H.species.eyes)
cybereyes_icon.Blend(eye_colour, ICON_ADD) // Eye implants override native DNA eye color
return cybereyes_icon
/obj/item/organ/internal/cyberimp/eyes/emp_act(severity)
if(!owner || emp_proof)
return
@@ -35,8 +47,6 @@
to_chat(owner, "<span class='warning'>Static obfuscates your vision!</span>")
owner.flash_eyes(visual = 1)
/obj/item/organ/internal/cyberimp/eyes/xray
name = "X-ray implant"
desc = "These cybernetic eye implants will give you X-ray vision. Blinking is futile."
+8
View File
@@ -337,6 +337,14 @@ I use this so that this can be made better once the organ overhaul rolls out --
return 0
return src == O.get_int_organ(organ_tag)
/obj/item/organ/proc/is_robotic(var/purist = FALSE)
if(purist && (robotic > 1 || status & (ORGAN_ROBOT))) //Only the robotiest.
return TRUE
if(robotic || status & (ORGAN_ROBOT|ORGAN_ASSISTED)) //Any tech will do.
return TRUE
return FALSE
/obj/item/organ/serialize()
var/data = ..()
if(status != 0)
@@ -664,7 +664,6 @@ Note that amputating the affected organ does in fact remove the infection from t
if(!owner)
return
var/is_robotic = status & ORGAN_ROBOT
var/mob/living/carbon/human/victim = owner
if(status & ORGAN_SPLINTED)
@@ -696,7 +695,7 @@ Note that amputating the affected organ does in fact remove the infection from t
victim.bodyparts_by_name[limb_name] = null // Remove from owner's vars.
//Robotic limbs explode if sabotaged.
if(is_robotic && sabotaged)
if(is_robotic() && sabotaged)
victim.visible_message(
"<span class='danger'>\The [victim]'s [src.name] explodes violently!</span>",\
"<span class='danger'>Your [src.name] explodes!</span>",\
+2 -10
View File
@@ -102,16 +102,8 @@ var/global/list/limb_icon_cache = list()
return
if(species.has_organ["eyes"])
var/obj/item/organ/internal/eyes/eyes = owner.get_int_organ(/obj/item/organ/internal/eyes)
var/obj/item/organ/internal/cyberimp/eyes/eye_implant = owner.get_int_organ(/obj/item/organ/internal/cyberimp/eyes)
if(species.eyes)
var/icon/eyes_icon = new/icon('icons/mob/human_face.dmi', species.eyes)
if(eye_implant) // Eye implants override native DNA eye color
eyes_icon.Blend(eye_implant.eye_colour, ICON_ADD)
else if(eyes)
eyes_icon = eyes.generate_icon()
else
eyes_icon.Blend("#800000", ICON_ADD)
var/icon/eyes_icon = owner.get_eyecon()
if(eyes_icon)
mob_icon.Blend(eyes_icon, ICON_OVERLAY)
overlays |= eyes_icon
+5 -10
View File
@@ -311,18 +311,9 @@
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)
return colourblind_matrix
@@ -332,6 +323,10 @@
/obj/item/organ/internal/eyes/proc/get_dark_view() //Returns dark_view (if the eyes are organic) for see_invisible handling in species.dm to be autoprocessed by life().
return dark_view
/obj/item/organ/internal/eyes/proc/shine()
if(is_robotic() || (dark_view > EYE_SHINE_THRESHOLD))
return TRUE
/obj/item/organ/internal/eyes/insert(mob/living/carbon/human/M, special = 0)
..()
if(istype(M) && eye_colour)