mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 14:08:31 +01:00
Moves hair and eyes into standing overlays (#95781)
This commit is contained in:
@@ -112,8 +112,11 @@
|
||||
/// Refreshes the visuals of the eyes
|
||||
/// If call_update is TRUE, we also will call update_body
|
||||
/obj/item/organ/eyes/proc/refresh(mob/living/carbon/eye_owner = owner, call_update = TRUE)
|
||||
owner.update_sight()
|
||||
owner.update_tint()
|
||||
if(isnull(eye_owner))
|
||||
return
|
||||
|
||||
eye_owner.update_sight()
|
||||
eye_owner.update_tint()
|
||||
|
||||
if(!ishuman(eye_owner))
|
||||
return
|
||||
@@ -131,7 +134,7 @@
|
||||
affected_human.add_fov_trait(type, native_fov)
|
||||
|
||||
if(call_update)
|
||||
affected_human.update_body()
|
||||
affected_human.update_eyes()
|
||||
|
||||
/obj/item/organ/eyes/on_mob_remove(mob/living/carbon/organ_owner, special, movement_flags)
|
||||
. = ..()
|
||||
@@ -144,7 +147,7 @@
|
||||
if(native_fov)
|
||||
organ_owner.remove_fov_trait(type)
|
||||
if(!special)
|
||||
human_owner.update_body()
|
||||
human_owner.update_eyes(refresh = FALSE)
|
||||
|
||||
// become blind (if not special)
|
||||
if(!special)
|
||||
@@ -173,6 +176,20 @@
|
||||
SIGNAL_REMOVETRAIT(TRAIT_REFLECTIVE_EYES),
|
||||
))
|
||||
|
||||
/obj/item/organ/eyes/on_bodypart_insert(obj/item/bodypart/limb)
|
||||
. = ..()
|
||||
if(ishuman(limb.owner))
|
||||
limb.owner.update_eyes(refresh = FALSE)
|
||||
else
|
||||
limb.update_icon_dropped()
|
||||
|
||||
/obj/item/organ/eyes/on_bodypart_remove(obj/item/bodypart/limb, movement_flags)
|
||||
. = ..()
|
||||
if(ishuman(limb.owner))
|
||||
limb.owner.update_eyes(refresh = FALSE)
|
||||
else
|
||||
limb.update_icon_dropped()
|
||||
|
||||
///Called whenever the luminescent and/or reflective eyes traits are added or removed
|
||||
/obj/item/organ/eyes/proc/on_shiny_eyes_trait_update(mob/living/carbon/human/source)
|
||||
SIGNAL_HANDLER
|
||||
@@ -182,7 +199,7 @@
|
||||
. = ..()
|
||||
if (ishuman(owner))
|
||||
refresh_atom_color_overrides()
|
||||
owner.update_body()
|
||||
owner.update_eyes()
|
||||
|
||||
/// Adds eye color overrides to our owner from our atom color
|
||||
/obj/item/organ/eyes/proc/refresh_atom_color_overrides()
|
||||
@@ -285,47 +302,42 @@
|
||||
// Always show if we have an appendix
|
||||
return ..() || (owner.stat != DEAD && !HAS_TRAIT(owner, TRAIT_KNOCKEDOUT) && (owner.is_blind() || owner.is_nearsighted()))
|
||||
|
||||
/// This proc generates a list of overlays that the eye should be displayed using for the given parent
|
||||
/obj/item/organ/eyes/proc/generate_body_overlay(mob/living/carbon/human/parent, obj/item/bodypart/limb)
|
||||
if(isnull(eye_icon_state))
|
||||
/// This proc generates a list of overlays that the eye displays on the given head
|
||||
/obj/item/organ/eyes/proc/generate_body_overlay(obj/item/bodypart/head/my_head)
|
||||
if(!eye_icon_state || isnull(my_head))
|
||||
return list()
|
||||
|
||||
var/mutable_appearance/eye_left = mutable_appearance(eye_icon, "[eye_icon_state]_l", -EYES_LAYER, parent || limb)
|
||||
var/mutable_appearance/eye_right = mutable_appearance(eye_icon, "[eye_icon_state]_r", -EYES_LAYER, parent || limb)
|
||||
var/eye_dir = my_head.owner ? null : SOUTH
|
||||
var/mutable_appearance/eye_left = mutable_appearance(eye_icon, "[eye_icon_state]_l", -EYES_LAYER)
|
||||
var/mutable_appearance/eye_right = mutable_appearance(eye_icon, "[eye_icon_state]_r", -EYES_LAYER)
|
||||
eye_left.dir = eye_dir
|
||||
eye_right.dir = eye_dir
|
||||
|
||||
var/list/overlays = list(eye_left, eye_right)
|
||||
|
||||
if(!(parent?.obscured_slots & HIDEEYES))
|
||||
overlays += get_emissive_overlays(eye_left, eye_right, parent || limb)
|
||||
if(my_head.owner && !(my_head.owner.obscured_slots & HIDEEYES))
|
||||
overlays += get_emissive_overlays(eye_left, eye_right, my_head)
|
||||
|
||||
if(!limb)
|
||||
return overlays
|
||||
|
||||
// Futureproofing for HARS/weird species
|
||||
var/obj/item/bodypart/head/head = astype(limb, /obj/item/bodypart/head)
|
||||
if(head?.head_flags & HEAD_EYECOLOR)
|
||||
if (parent)
|
||||
eye_right.color = parent.get_right_eye_color()
|
||||
eye_left.color = parent.get_left_eye_color()
|
||||
var/list/eyelids = setup_eyelids(eye_left, eye_right, parent)
|
||||
if (LAZYLEN(eyelids))
|
||||
overlays += eyelids
|
||||
else
|
||||
eye_right.color = eye_color_right
|
||||
eye_left.color = eye_color_left
|
||||
if(my_head.head_flags & HEAD_EYECOLOR)
|
||||
eye_right.color = eye_color_right || my_head.owner?.get_right_eye_color()
|
||||
eye_left.color = eye_color_left || my_head.owner?.get_left_eye_color()
|
||||
var/list/eyelids = get_eyelid_overlays(eye_left, eye_right, my_head)
|
||||
if (LAZYLEN(eyelids))
|
||||
overlays += eyelids
|
||||
|
||||
if (scarring & RIGHT_EYE_SCAR)
|
||||
var/mutable_appearance/right_scar = mutable_appearance('icons/mob/human/human_eyes.dmi', "eye_scar_right", -EYES_LAYER, parent || limb)
|
||||
right_scar.color = limb.draw_color
|
||||
var/mutable_appearance/right_scar = mutable_appearance('icons/mob/human/human_eyes.dmi', "eye_scar_right", -EYES_LAYER)
|
||||
right_scar.color = my_head.draw_color
|
||||
overlays += right_scar
|
||||
|
||||
if (scarring & LEFT_EYE_SCAR)
|
||||
var/mutable_appearance/left_scar = mutable_appearance('icons/mob/human/human_eyes.dmi', "eye_scar_left", -EYES_LAYER, parent || limb)
|
||||
left_scar.color = limb.draw_color
|
||||
var/mutable_appearance/left_scar = mutable_appearance('icons/mob/human/human_eyes.dmi', "eye_scar_left", -EYES_LAYER)
|
||||
left_scar.color = my_head.draw_color
|
||||
overlays += left_scar
|
||||
|
||||
if(head?.worn_face_offset)
|
||||
if(my_head.worn_face_offset)
|
||||
for (var/mutable_appearance/overlay as anything in overlays)
|
||||
head.worn_face_offset.apply_offset(overlay)
|
||||
my_head.worn_face_offset.apply_offset(overlay)
|
||||
|
||||
return overlays
|
||||
|
||||
@@ -392,7 +404,7 @@
|
||||
owner.assign_nearsightedness(TRAIT_LEFT_EYE_SCAR, 1, FALSE)
|
||||
if((scarring & RIGHT_EYE_SCAR) && (scarring & LEFT_EYE_SCAR))
|
||||
owner.become_blind(EYE_SCARRING_TRAIT)
|
||||
owner.update_body()
|
||||
owner.update_eyes()
|
||||
|
||||
/obj/item/organ/eyes/proc/fix_scar(side)
|
||||
if (!(scarring & side))
|
||||
@@ -404,7 +416,7 @@
|
||||
return
|
||||
owner.cure_nearsighted(side == RIGHT_EYE_SCAR ? TRAIT_RIGHT_EYE_SCAR : TRAIT_LEFT_EYE_SCAR)
|
||||
owner.cure_blind(EYE_SCARRING_TRAIT)
|
||||
owner.update_body()
|
||||
owner.update_eyes()
|
||||
|
||||
#undef OFFSET_X
|
||||
#undef OFFSET_Y
|
||||
@@ -448,10 +460,10 @@
|
||||
#define BLINK_LOOPS 5
|
||||
|
||||
/// Modifies eye overlays to also act as eyelids, both for blinking and for when you're knocked out cold
|
||||
/obj/item/organ/eyes/proc/setup_eyelids(mutable_appearance/eye_left, mutable_appearance/eye_right, mob/living/carbon/human/parent)
|
||||
var/obj/item/bodypart/head/my_head = parent.get_bodypart(BODY_ZONE_HEAD)
|
||||
/obj/item/organ/eyes/proc/get_eyelid_overlays(mutable_appearance/eye_left, mutable_appearance/eye_right, obj/item/bodypart/head/my_head)
|
||||
var/mob/living/carbon/human/parent = my_head.owner
|
||||
// Robotic eyes or colorless heads don't get the privelege of having eyelids
|
||||
if (IS_ROBOTIC_ORGAN(src) || !my_head.draw_color || HAS_TRAIT(parent, TRAIT_NO_EYELIDS))
|
||||
if (isnull(parent) || IS_ROBOTIC_ORGAN(src) || !my_head.draw_color || HAS_TRAIT(parent, TRAIT_NO_EYELIDS))
|
||||
return
|
||||
|
||||
var/list/base_color = rgb2num(my_head.draw_color, COLORSPACE_HSL)
|
||||
|
||||
@@ -558,12 +558,12 @@
|
||||
"Security Status" = JUDGE_RECORDCHECK,
|
||||
)
|
||||
|
||||
/obj/item/organ/eyes/robotic/tacvisor/generate_body_overlay(mob/living/carbon/human/parent, obj/item/bodypart/limb)
|
||||
var/mutable_appearance/visor_overlay = mutable_appearance(eye_icon, eye_icon_state, -EYES_LAYER, parent || limb)
|
||||
/obj/item/organ/eyes/robotic/tacvisor/generate_body_overlay(obj/item/bodypart/limb)
|
||||
var/mutable_appearance/visor_overlay = mutable_appearance(eye_icon, eye_icon_state, -EYES_LAYER)
|
||||
var/list/eye_overlays = list(visor_overlay)
|
||||
|
||||
var/mob/living/carbon/human/parent = limb.owner
|
||||
if (parent && parent.appears_alive() && !HAS_TRAIT(parent, TRAIT_KNOCKEDOUT))
|
||||
var/mutable_appearance/display_overlay = mutable_appearance(eye_icon, "[eye_icon_state]_[LOWER_TEXT(visor_display)]", -EYES_LAYER, parent)
|
||||
var/mutable_appearance/display_overlay = mutable_appearance(eye_icon, "[eye_icon_state]_[LOWER_TEXT(visor_display)]", -EYES_LAYER)
|
||||
eye_overlays += display_overlay
|
||||
if(!(parent.obscured_slots & HIDEEYES))
|
||||
eye_overlays += emissive_appearance(eye_icon, "[eye_icon_state]_[LOWER_TEXT(visor_display)]", parent, -EYES_LAYER)
|
||||
|
||||
Reference in New Issue
Block a user