mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-20 18:47:20 +01:00
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:
@@ -1668,16 +1668,38 @@
|
||||
G.icon_state = "grabbed1"
|
||||
G.synch()
|
||||
|
||||
/mob/living/carbon/human/proc/get_eyecon()
|
||||
var/obj/item/organ/internal/eyes/eyes = get_int_organ(/obj/item/organ/internal/eyes)
|
||||
var/obj/item/organ/internal/cyberimp/eyes/eye_implant = get_int_organ(/obj/item/organ/internal/cyberimp/eyes)
|
||||
if(istype(species) && species.eyes)
|
||||
var/icon/eyes_icon = new/icon('icons/mob/human_face.dmi', species.eyes)
|
||||
if(eye_implant) //Eye implants override native DNA eye colo(u)r
|
||||
eyes_icon = eye_implant.generate_icon()
|
||||
else if(eyes)
|
||||
eyes_icon = eyes.generate_icon()
|
||||
else
|
||||
eyes_icon.Blend("#800000", ICON_ADD)
|
||||
|
||||
return eyes_icon
|
||||
|
||||
/mob/living/carbon/human/proc/get_eye_shine() //Referenced cult constructs for shining in the dark. Needs to be above lighting effects such as shading.
|
||||
var/obj/item/organ/external/head/head_organ = 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(get_eyecon(), 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.
|
||||
|
||||
/*Used to check if eyes should shine in the dark. Returns the image of the eyes on the layer where they will appear to shine.
|
||||
Eyes need to have significantly high darksight to shine unless the mob has the XRAY vision mutation. Eyes will not shine if they are covered in any way.*/
|
||||
/mob/living/carbon/human/proc/eyes_shine()
|
||||
var/obj/item/organ/internal/eyes/eyes = get_int_organ(/obj/item/organ/internal/eyes)
|
||||
if(!istype(eyes))
|
||||
return FALSE
|
||||
if(!(eyes.get_dark_view() > EYE_SHINE_THRESHOLD) && !(XRAY in mutations))
|
||||
var/obj/item/organ/internal/cyberimp/eyes/eye_implant = get_int_organ(/obj/item/organ/internal/cyberimp/eyes)
|
||||
if(!(istype(eyes) || istype(eye_implant)))
|
||||
return FALSE
|
||||
if(!get_location_accessible(src, "eyes"))
|
||||
return FALSE
|
||||
if(!(eyes.shine()) && !istype(eye_implant) && !(XRAY in mutations)) //If their eyes don't shine, they don't have other augs, nor do they have X-RAY vision
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -1334,8 +1334,7 @@ var/global/list/damage_icon_parts = list()
|
||||
|
||||
//Begin appending miscellaneous effects.
|
||||
if(eyes_shine())
|
||||
var/obj/item/organ/internal/eyes/E = get_int_organ(/obj/item/organ/internal/eyes)
|
||||
misc_effect_overlays += E.get_eye_shine() //Image layer is specified in get_eye_shine() proc as LIGHTING_LAYER + 1.
|
||||
misc_effect_overlays += get_eye_shine() //Image layer is specified in get_eye_shine() proc as LIGHTING_LAYER + 1.
|
||||
|
||||
/mob/living/carbon/human/proc/force_update_limbs()
|
||||
for(var/obj/item/organ/external/O in bodyparts)
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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>",\
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user