Merge pull request #10120 from Citadel-Station-13/night_vision

Night vision trait but it just boosts barely-lit visibility
This commit is contained in:
Ghom
2019-12-21 15:30:32 +01:00
committed by GitHub
4 changed files with 20 additions and 7 deletions

View File

@@ -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
#define FLASH_LIGHT_RANGE 3.8

View File

@@ -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 = "<span class='notice'>The shadows seem a little less dark.</span>"
lose_text = "<span class='danger'>Everything seems a little darker.</span>"
/datum/quirk/night_vision/on_spawn()
var/mob/living/carbon/human/H = quirk_holder
H.update_sight()

View File

@@ -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 ..()
return ..()

View File

@@ -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()
. = ..()