Fixes an issue with flashing (#20265)

* fixes it
Adds a check for the mob's eye status & moves checks above parent call

* i hate github

* coding chat advice

* unbuffs slimes
I had to rewrite the whole PR for this :(

* tweak + comments

* rewrites the PR again

* oops

* farie request

* aaa

* Apply suggestions from code review

Mostly whitespace & an implied thing

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* another code review commit
Moves checks that stop eye damage but not flashing back

---------

Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
JimKil3
2023-01-29 03:00:28 -05:00
committed by GitHub
parent 22ea84d449
commit 47f71ccde1
3 changed files with 30 additions and 3 deletions
+13 -2
View File
@@ -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
@@ -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
+8 -1
View File
@@ -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