diff --git a/code/__DEFINES/lighting.dm b/code/__DEFINES/lighting.dm index 13dccc74fe..89c702e605 100644 --- a/code/__DEFINES/lighting.dm +++ b/code/__DEFINES/lighting.dm @@ -59,11 +59,13 @@ #define LIGHT_RANGE_FIRE 3 //How many tiles standard fires glow. #define LIGHTING_PLANE_ALPHA_VISIBLE 255 -#define LIGHTING_PLANE_ALPHA_NV_TRAIT 250 +#define LIGHTING_PLANE_ALPHA_NV_TRAIT 223 #define LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE 192 #define LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE 128 //For lighting alpha, small amounts lead to big changes. even at 128 its hard to figure out what is dark and what is light, at 64 you almost can't even tell. #define LIGHTING_PLANE_ALPHA_INVISIBLE 0 +#define NIGHT_VISION_DARKSIGHT_RANGE 3 + //lighting area defines #define DYNAMIC_LIGHTING_DISABLED 0 //dynamic lighting disabled (area stays at full brightness) #define DYNAMIC_LIGHTING_ENABLED 1 //dynamic lighting enabled @@ -80,4 +82,4 @@ #define FLASH_LIGHT_DURATION 2 #define FLASH_LIGHT_POWER 3 -#define FLASH_LIGHT_RANGE 3.8 \ No newline at end of file +#define FLASH_LIGHT_RANGE 3.8 diff --git a/code/datums/traits/good.dm b/code/datums/traits/good.dm index 15ac70a2c7..b74f24c469 100644 --- a/code/datums/traits/good.dm +++ b/code/datums/traits/good.dm @@ -208,3 +208,15 @@ /datum/quirk/bloodpressure/remove() var/mob/living/M = quirk_holder M.blood_ratio = 1 + +/datum/quirk/night_vision + name = "Night Vision" + desc = "You can see slightly more clearly in full darkness than most people." + value = 1 + mob_trait = TRAIT_NIGHT_VISION + gain_text = "The shadows seem a little less dark." + lose_text = "Everything seems a little darker." + +/datum/quirk/night_vision/on_spawn() + var/mob/living/carbon/human/H = quirk_holder + H.update_sight() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index f2746823cb..6ecedba3be 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -598,6 +598,9 @@ sight |= E.sight_flags if(!isnull(E.lighting_alpha)) lighting_alpha = E.lighting_alpha + if(HAS_TRAIT(src, TRAIT_NIGHT_VISION)) + lighting_alpha = min(LIGHTING_PLANE_ALPHA_NV_TRAIT, lighting_alpha) + see_in_dark = max(NIGHT_VISION_DARKSIGHT_RANGE, see_in_dark) if(client.eye && client.eye != src) var/atom/A = client.eye @@ -973,4 +976,4 @@ /mob/living/carbon/transfer_ckey(mob/new_mob, send_signal = TRUE) if(combatmode) toggle_combat_mode(TRUE, TRUE) - return ..() \ No newline at end of file + return ..() diff --git a/code/modules/surgery/organs/eyes.dm b/code/modules/surgery/organs/eyes.dm index c61f1a8122..2ddbd672c5 100644 --- a/code/modules/surgery/organs/eyes.dm +++ b/code/modules/surgery/organs/eyes.dm @@ -44,13 +44,9 @@ eye_color = H.eye_color if(!special) H.dna?.species?.handle_body() //regenerate eyeballs overlays. - if(HAS_TRAIT(H, TRAIT_NIGHT_VISION) && !lighting_alpha) - lighting_alpha = LIGHTING_PLANE_ALPHA_NV_TRAIT - see_in_dark = 8 M.update_tint() owner.update_sight() - /obj/item/organ/eyes/Remove(mob/living/carbon/M, special = 0) clear_eye_trauma() . = ..()