mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user