diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 7dfdf6c08ad..e9aea382af2 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -357,8 +357,17 @@ if(HAS_TRAIT(H, TRAIT_SKELETONIZED) && (!H.w_uniform) && (!H.wear_suit)) H.play_xylophone() -/mob/living/carbon/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, laser_pointer = FALSE, type = /obj/screen/fullscreen/flash) +/mob/living/carbon/can_be_flashed(intensity = 1, override_blindness_check = 0) + var/obj/item/organ/internal/eyes/E = get_int_organ(/obj/item/organ/internal/eyes) . = ..() + + if((E && (E.status & ORGAN_DEAD)) || !.) + return FALSE + +/mob/living/carbon/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, laser_pointer = FALSE, type = /obj/screen/fullscreen/flash) + //Parent proc checks if a mob can_be_flashed() + . = ..() + SIGNAL_HANDLER SEND_SIGNAL(src, COMSIG_CARBON_FLASH_EYES, laser_pointer) var/damage = intensity - check_eye_prot() @@ -366,8 +375,10 @@ if(.) if(visual) return + + //Checks that shouldn't stop flashing, but should stop eye damage, so they go here instead of in can_be_flashed() var/obj/item/organ/internal/eyes/E = get_int_organ(/obj/item/organ/internal/eyes) - if(!E || (E && E.weld_proof)) + if(!E || E.weld_proof) return var/extra_darkview = 0 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index a59f1ef1b45..74c0864567d 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -930,6 +930,15 @@ rank = "AI" set_criminal_status(user, found_record, new_status, reason, rank) +/mob/living/carbon/human/can_be_flashed(intensity = 1, override_blindness_check = 0) + + var/obj/item/organ/internal/eyes/E = get_int_organ(/obj/item/organ/internal/eyes) + . = ..() + + if((!. || (!E && !(dna.species.bodyflags & NO_EYES)))) + return FALSE + + return TRUE ///check_eye_prot() ///Returns a number between -1 to 2 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 5e93beeb6dd..04ba1d8b13f 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -830,9 +830,16 @@ /mob/living/proc/can_use_vents() return "You can't fit into that vent." +//Checks for anything other than eye protection that would stop flashing. Overridden in carbon.dm and human.dm +/mob/living/proc/can_be_flashed(intensity = 1, override_blindness_check = 0) + if(check_eye_prot() >= intensity || (!override_blindness_check && (HAS_TRAIT(src, TRAIT_BLIND) || HAS_TRAIT(src, TRAIT_FLASH_PROTECTION)))) + return FALSE + + return TRUE + //called when the mob receives a bright flash /mob/living/proc/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, laser_pointer = FALSE, type = /obj/screen/fullscreen/flash) - if(check_eye_prot() < intensity && (override_blindness_check || !HAS_TRAIT(src, TRAIT_BLIND)) && !HAS_TRAIT(src, TRAIT_FLASH_PROTECTION)) + if(can_be_flashed(intensity, override_blindness_check)) overlay_fullscreen("flash", type) addtimer(CALLBACK(src, PROC_REF(clear_fullscreen), "flash", 25), 25) return 1