Improve nearsighted code (#66327)

This refactors the nearsighted code into it's own proc that was salvaged from #66306. Just a code improvement with no game changes.
This commit is contained in:
Tim
2022-05-08 10:53:02 -07:00
committed by GitHub
parent ae25df16bb
commit 856669f25f
3 changed files with 11 additions and 8 deletions
@@ -766,6 +766,12 @@
heat_exposure_stacks = 0
return ..()
/mob/living/carbon/human/is_nearsighted()
var/obj/item/clothing/glasses/eyewear = glasses
if(istype(eyewear) && eyewear.vision_correction)
return FALSE
return ..()
/mob/living/carbon/human/is_literate()
return TRUE
+1 -8
View File
@@ -45,14 +45,7 @@
. = TRUE
// Handling nearsightnedness
if(. && HAS_TRAIT(src, TRAIT_NEARSIGHT))
//Checking if our dude really is suffering from nearsightness! (very nice nearsightness code)
if(iscarbon(src))
var/mob/living/carbon/carbon_me = src
if(carbon_me.glasses)
var/obj/item/clothing/glasses/glass = carbon_me.glasses
if(glass.vision_correction)
return
if(. && is_nearsighted())
if((rel_x >= NEARSIGHTNESS_FOV_BLINDNESS || rel_x <= -NEARSIGHTNESS_FOV_BLINDNESS) || (rel_y >= NEARSIGHTNESS_FOV_BLINDNESS || rel_y <= -NEARSIGHTNESS_FOV_BLINDNESS))
return FALSE
+4
View File
@@ -1144,6 +1144,10 @@
/mob/proc/has_nightvision()
return see_in_dark >= NIGHTVISION_FOV_RANGE
/// Is this mob affected by nearsight
/mob/proc/is_nearsighted()
return HAS_TRAIT(src, TRAIT_NEARSIGHT)
/// This mob is abile to read books
/mob/proc/is_literate()
return FALSE