diff --git a/.github/guides/VISUALS.md b/.github/guides/VISUALS.md index 1c3cc6360c5..82ee0c6b5d6 100644 --- a/.github/guides/VISUALS.md +++ b/.github/guides/VISUALS.md @@ -365,8 +365,6 @@ You can actually force it to use a particular mob's sight to avoid aspects of th - [Table of Contents](#table-of-contents) - [Reference Entry](https://www.byond.com/docs/ref/#/mob/var/see_in_dark) -`/mob/var/see_in_dark` sets the radius of a square around the mob that cuts out BYOND darkness. - This is why when you stand in darkness you can see yourself, and why you can see a line of objects appear when you use mesons (horrible effect btw). It's quite simple, but worth describing. diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm index 005d6594257..750b69fb5a6 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm @@ -78,8 +78,6 @@ #define COMSIG_MOB_SIGHT_CHANGE "mob_sight_changed" ///from base of mob/set_invis_see(): (new_invis, old_invis) #define COMSIG_MOB_SEE_INVIS_CHANGE "mob_see_invis_change" -///from base of mob/set_see_in_dark(): (new_range, old_range) -#define COMSIG_MOB_SEE_IN_DARK_CHANGE "mob_see_in_dark_change" ///from base of /mob/living/proc/apply_damage(): (damage, damagetype, def_zone, blocked, wound_bonus, bare_wound_bonus, sharpness, attack_direction) diff --git a/code/__DEFINES/fov.dm b/code/__DEFINES/fov.dm index d35d30cdfea..164dd1ead99 100644 --- a/code/__DEFINES/fov.dm +++ b/code/__DEFINES/fov.dm @@ -10,9 +10,6 @@ /// Range at which FOV effects treat nearsightness as blind and play #define NEARSIGHTNESS_FOV_BLINDNESS 2 -/// Range in tiles that a mob can see in the dark (used to determine if a mob has night_vision) -#define NIGHTVISION_FOV_RANGE 8 - //Fullscreen overlay resolution in tiles for the clients view. /// The fullscreen overlay in tiles for x axis #define FULLSCREEN_OVERLAY_RESOLUTION_X 15 diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index 82bf1f9c807..2a5451a910c 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -12,10 +12,12 @@ #define PLANE_SPACE -25 #define PLANE_SPACE_PARALLAX -20 -#define GRAVITY_PULSE_PLANE -12 +#define GRAVITY_PULSE_PLANE -13 #define GRAVITY_PULSE_RENDER_TARGET "*GRAVPULSE_RENDER_TARGET" -#define RENDER_PLANE_TRANSPARENT -11 //Transparent plane that shows openspace underneath the floor +#define RENDER_PLANE_TRANSPARENT -12 //Transparent plane that shows openspace underneath the floor + +#define TRANSPARENT_FLOOR_PLANE -11 #define FLOOR_PLANE -10 @@ -57,11 +59,12 @@ #define EMISSIVE_SPACE_LAYER 3 #define EMISSIVE_WALL_LAYER 4 -/// Masks the emissive plane -#define EMISSIVE_MASK_PLANE 15 -#define EMISSIVE_MASK_RENDER_TARGET "*EMISSIVE_MASK_PLANE" +#define RENDER_PLANE_LIGHTING 15 -#define RENDER_PLANE_LIGHTING 16 +/// Masks the lighting plane with turfs, so we never light up the void +/// Failing that, masks emissives and the overlay lighting plane +#define LIGHT_MASK_PLANE 16 +#define LIGHT_MASK_RENDER_TARGET "*LIGHT_MASK_PLANE" ///Things that should render ignoring lighting #define ABOVE_LIGHTING_PLANE 17 @@ -281,12 +284,13 @@ //Describes how different plane masters behave when they are being culled for performance reasons /// This plane master will not go away if its layer is culled. useful for preserving effects #define PLANE_CRITICAL_DISPLAY (1<<0) -/// This plane master will temporarially remove relays to non critical planes if it's layer is culled (and it's critical) -/// This is VERY hacky, but needed to ensure that some instances of BLEND_MULITPLY work as expected (fuck you god damn parallax) -/// It also implies that the critical plane has a *'d render target, making it mask itself -#define PLANE_CRITICAL_NO_EMPTY_RELAY (1<<1) +/// This plane master will temporarially remove relays to all other planes +/// Allows us to retain the effects of a plane while cutting off the changes it makes +#define PLANE_CRITICAL_NO_RELAY (1<<1) +/// We assume this plane master has a render target starting with *, it'll be removed, forcing it to render in place +#define PLANE_CRITICAL_CUT_RENDER (1<<2) -#define PLANE_CRITICAL_FUCKO_PARALLAX (PLANE_CRITICAL_DISPLAY|PLANE_CRITICAL_NO_EMPTY_RELAY) +#define PLANE_CRITICAL_FUCKO_PARALLAX (PLANE_CRITICAL_DISPLAY|PLANE_CRITICAL_NO_RELAY|PLANE_CRITICAL_CUT_RENDER) /// A value of /datum/preference/numeric/multiz_performance that disables the option #define MULTIZ_PERFORMANCE_DISABLE -1 diff --git a/code/__DEFINES/lighting.dm b/code/__DEFINES/lighting.dm index 7bda18b5cd5..2a16d34a0cb 100644 --- a/code/__DEFINES/lighting.dm +++ b/code/__DEFINES/lighting.dm @@ -35,12 +35,16 @@ ///How many tiles standard fires glow. #define LIGHT_RANGE_FIRE 3 -#define LIGHTING_PLANE_ALPHA_VISIBLE 255 -#define LIGHTING_PLANE_ALPHA_NV_TRAIT 245 -#define LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE 192 -/// 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_MOSTLY_INVISIBLE 128 -#define LIGHTING_PLANE_ALPHA_INVISIBLE 0 +// Lighting cutoff defines +// These are a percentage of how much darkness to cut off (in rgb) +#define LIGHTING_CUTOFF_VISIBLE 0 +#define LIGHTING_CUTOFF_REAL_LOW 4.5 +#define LIGHTING_CUTOFF_MEDIUM 15 +#define LIGHTING_CUTOFF_HIGH 30 +#define LIGHTING_CUTOFF_FULLBRIGHT 100 + +/// What counts as being able to see in the dark +#define LIGHTING_NIGHTVISION_THRESHOLD 10 /// The amount of lumcount on a tile for it to be considered dark (used to determine reading and nyctophobia) #define LIGHTING_TILE_IS_DARK 0.2 diff --git a/code/__DEFINES/sight.dm b/code/__DEFINES/sight.dm index 09ae20fee08..ab70cb9895b 100644 --- a/code/__DEFINES/sight.dm +++ b/code/__DEFINES/sight.dm @@ -28,8 +28,7 @@ #define VISOR_FLASHPROTECT (1<<0) #define VISOR_TINT (1<<1) #define VISOR_VISIONFLAGS (1<<2) //all following flags only matter for glasses -#define VISOR_DARKNESSVIEW (1<<3) -#define VISOR_INVISVIEW (1<<4) +#define VISOR_INVISVIEW (1<<3) // BYOND internal values for the sight flags // See [https://www.byond.com/docs/ref/#/mob/var/sight] @@ -55,6 +54,6 @@ /// NOTE: this does not function with the SIDE_MAP map format. So we can't. :( //#define SEE_BLACKNESS (1<<10) -/// Bitfield of sight flags that show things "inside" the blackness plane -/// We've gotta alpha it down if we get this, cause otherwise the sight flag won't work -#define BLACKNESS_CUTTING (SEE_MOBS|SEE_OBJS|SEE_TURFS|SEE_TURFS|SEE_TURFS) +/// Bitfield of sight flags that show THINGS but no lighting +/// Since lighting is an underlay on turfs, this is everything but that +#define SEE_AVOID_TURF_BLACKNESS (SEE_MOBS|SEE_OBJS) diff --git a/code/__HELPERS/colors.dm b/code/__HELPERS/colors.dm index 760704cc560..d44801af5d7 100644 --- a/code/__HELPERS/colors.dm +++ b/code/__HELPERS/colors.dm @@ -61,5 +61,37 @@ flashed_client.color = flash_color animate(flashed_client, color = animate_color, time = flash_time) +/// Blends together two colors (passed as 3 or 4 length lists) using the screen blend mode +/// Much like multiply, screen effects the brightness of the resulting color +/// Screen blend will always lighten the resulting color, since before multiplication we invert the colors +/// This makes our resulting output brighter instead of darker +/proc/blend_screen_color(list/first_color, list/second_color) + var/list/output = new /list(4) + + // max out any non existant alphas + if(length(first_color) < 4) + first_color[4] = 255 + if(length(second_color) < 4) + second_color[4] = 255 + + // time to do our blending + for(var/i in 1 to 4) + output[i] = (1 - (1 - first_color[i] / 255) * (1 - second_color[i] / 255)) * 255 + return output + +/// Used to blend together two different color cutoffs +/// Uses the screen blendmode under the hood, essentially just [/proc/blend_screen_color] +/// But paired down and modified to work for our color range +/// Accepts the color cutoffs as two 3 length list(0-100,...) arguments +/proc/blend_cutoff_colors(list/first_color, list/second_color) + var/list/output = new /list(3) + + // Invert the colors, multiply to "darken" (actually lights), then uninvert to get back to what we want + for(var/i in 1 to 3) + output[i] = (1 - (1 - first_color[i] / 100) * (1 - second_color[i] / 100)) * 100 + + return output + + #define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255))) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 673ff5f3335..6bb27208dcb 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -756,7 +756,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) name = "INTERNAL DVIEW MOB" invisibility = 101 density = FALSE - see_in_dark = 1e6 move_resist = INFINITY var/ready_to_die = FALSE diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm index 325c719156b..18008fc6f78 100644 --- a/code/_onclick/hud/fullscreen.dm +++ b/code/_onclick/hud/fullscreen.dm @@ -196,7 +196,7 @@ /atom/movable/screen/fullscreen/lighting_backdrop icon = 'icons/hud/screen_gen.dmi' icon_state = "flash" - transform = matrix(200, 0, 0, 0, 200, 0) + screen_loc = "WEST,SOUTH to EAST,NORTH" plane = LIGHTING_PLANE layer = LIGHTING_ABOVE_ALL blend_mode = BLEND_OVERLAY diff --git a/code/_onclick/hud/rendering/plane_master.dm b/code/_onclick/hud/rendering/plane_master.dm index 3dc95408f44..d867fb2cea5 100644 --- a/code/_onclick/hud/rendering/plane_master.dm +++ b/code/_onclick/hud/rendering/plane_master.dm @@ -143,12 +143,9 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/plane_master) return TRUE our_client.screen += src - if(!(critical & PLANE_CRITICAL_NO_EMPTY_RELAY)) + if(!(critical & PLANE_CRITICAL_NO_RELAY)) our_client.screen += relays return TRUE - for(var/atom/movable/render_plane_relay/relay as anything in relays) - if(relay.critical_target) - our_client.screen += relay return TRUE if(!our_client) @@ -208,34 +205,33 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/plane_master) is_outside_bounds = TRUE // If we're of critical importance, AND we're below the rendering layer if(critical & PLANE_CRITICAL_DISPLAY) - if(!(critical & PLANE_CRITICAL_NO_EMPTY_RELAY)) + // We here assume that your render target starts with * + if(critical & PLANE_CRITICAL_CUT_RENDER && render_target) + render_target = copytext_char(render_target, 2) + if(!(critical & PLANE_CRITICAL_NO_RELAY)) return var/client/our_client = relevant.client if(our_client) for(var/atom/movable/render_plane_relay/relay as anything in relays) - if(!relay.critical_target) - our_client.screen -= relay + our_client.screen -= relay - // We here assume that your render target starts with * - if(render_target) - render_target = copytext_char(render_target, 2) return hide_from(relevant) /atom/movable/screen/plane_master/proc/inside_bounds(mob/relevant) is_outside_bounds = FALSE if(critical & PLANE_CRITICAL_DISPLAY) - if(!(critical & PLANE_CRITICAL_NO_EMPTY_RELAY)) + // We here assume that your render target starts with * + if(critical & PLANE_CRITICAL_CUT_RENDER && render_target) + render_target = "*[render_target]" + + if(!(critical & PLANE_CRITICAL_NO_RELAY)) return var/client/our_client = relevant.client if(our_client) for(var/atom/movable/render_plane_relay/relay as anything in relays) - if(!relay.critical_target) - our_client.screen += relay + our_client.screen += relay - // We here assume that your render target starts with * - if(render_target) - render_target = "*[render_target]" return show_to(relevant) @@ -266,7 +262,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/plane_master)
If you want something to look as if it has parallax on it, draw it to this plane." plane = PLANE_SPACE appearance_flags = PLANE_MASTER|NO_CLIENT_COLOR - render_relay_planes = list(RENDER_PLANE_GAME, EMISSIVE_MASK_PLANE) + render_relay_planes = list(RENDER_PLANE_GAME, LIGHT_MASK_PLANE) critical = PLANE_CRITICAL_FUCKO_PARALLAX // goes funny when touched. no idea why I don't trust byond /atom/movable/screen/plane_master/parallax_white/Initialize(mapload, datum/plane_master_group/home, offset) @@ -353,7 +349,16 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/plane_master) name = "Floor" documentation = "The well, floor. This is mostly used as a sorting mechanism, but it also lets us create a \"border\" around the game world plane, so its drop shadow will actually work." plane = FLOOR_PLANE - render_relay_planes = list(RENDER_PLANE_GAME, EMISSIVE_MASK_PLANE) + render_relay_planes = list(RENDER_PLANE_GAME, LIGHT_MASK_PLANE) + +/atom/movable/screen/plane_master/transparent_floor + name = "Transparent Floor" + documentation = "Really just openspace, stuff that is a turf but has no color or alpha whatsoever.\ +
We use this to draw to just the light mask plane, cause if it's not there we get holes of blackness over openspace" + plane = TRANSPARENT_FLOOR_PLANE + render_relay_planes = list(LIGHT_MASK_PLANE) + // Needs to be critical or it uh, it'll look white + critical = PLANE_CRITICAL_DISPLAY|PLANE_CRITICAL_NO_RELAY /atom/movable/screen/plane_master/floor/Initialize(mapload, datum/plane_master_group/home, offset) . = ..() @@ -363,7 +368,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/plane_master) name = "Wall" documentation = "Holds all walls. We render this onto the game world. Separate so we can use this + space and floor planes as a guide for where byond blackness is NOT." plane = WALL_PLANE - render_relay_planes = list(RENDER_PLANE_GAME_WORLD, EMISSIVE_MASK_PLANE) + render_relay_planes = list(RENDER_PLANE_GAME_WORLD, LIGHT_MASK_PLANE) /atom/movable/screen/plane_master/wall/Initialize(mapload, datum/plane_master_group/home, offset) . = ..() @@ -416,7 +421,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/plane_master) documentation = "There are some walls that want to render above most things (mostly minerals since they shift over.\
We draw them to their own plane so we can hijack them for our emissive mask stuff" plane = WALL_PLANE_UPPER - render_relay_planes = list(RENDER_PLANE_GAME_WORLD, EMISSIVE_MASK_PLANE) + render_relay_planes = list(RENDER_PLANE_GAME_WORLD, LIGHT_MASK_PLANE) /atom/movable/screen/plane_master/wall_upper/Initialize(mapload, datum/plane_master_group/home, offset) . = ..() diff --git a/code/_onclick/hud/rendering/plane_master_group.dm b/code/_onclick/hud/rendering/plane_master_group.dm index b1e1768ea20..b9f60ff8e9d 100644 --- a/code/_onclick/hud/rendering/plane_master_group.dm +++ b/code/_onclick/hud/rendering/plane_master_group.dm @@ -70,6 +70,10 @@ /datum/plane_master_group/proc/show_plane(atom/movable/screen/plane_master/plane) plane.show_to(our_hud.mymob) +/// Nice wrapper for the "[]"ing +/datum/plane_master_group/proc/get_plane(plane) + return plane_masters["[plane]"] + /// Returns a list of all the plane master types we want to create /datum/plane_master_group/proc/get_plane_types() return subtypesof(/atom/movable/screen/plane_master) - /atom/movable/screen/plane_master/rendering_plate diff --git a/code/_onclick/hud/rendering/render_plate.dm b/code/_onclick/hud/rendering/render_plate.dm index 7eeb4c052e4..438c6649de6 100644 --- a/code/_onclick/hud/rendering/render_plate.dm +++ b/code/_onclick/hud/rendering/render_plate.dm @@ -127,6 +127,8 @@ blend_mode_override = BLEND_MULTIPLY mouse_opacity = MOUSE_OPACITY_TRANSPARENT critical = PLANE_CRITICAL_DISPLAY + /// A list of light cutoffs we're actively using, (mass, r, g, b) to avoid filter churn + var/list/light_cutoffs /*! * This system works by exploiting BYONDs color matrix filter to use layers to handle emissive blockers. @@ -142,6 +144,7 @@ . = ..() add_filter("emissives", 1, alpha_mask_filter(render_source = OFFSET_RENDER_TARGET(EMISSIVE_RENDER_TARGET, offset), flags = MASK_INVERSE)) add_filter("object_lighting", 2, alpha_mask_filter(render_source = OFFSET_RENDER_TARGET(O_LIGHTING_VISUAL_RENDER_TARGET, offset), flags = MASK_INVERSE)) + set_light_cutoff(10) /atom/movable/screen/plane_master/rendering_plate/lighting/show_to(mob/mymob) . = ..() @@ -152,10 +155,10 @@ // Basically, we need something to brighten // unlit is perhaps less needed rn, it exists to provide a fullbright for things that can't see the lighting plane // but we don't actually use invisibility to hide the lighting plane anymore, so it's pointless - var/atom/movable/screen/backdrop = mymob.overlay_fullscreen("lighting_backdrop_lit#[offset]", /atom/movable/screen/fullscreen/lighting_backdrop/lit) + var/atom/movable/screen/backdrop = mymob.overlay_fullscreen("lighting_backdrop_lit_[home.key]#[offset]", /atom/movable/screen/fullscreen/lighting_backdrop/lit) // Need to make sure they're on our plane, ALL the time. We always need a backdrop SET_PLANE_EXPLICIT(backdrop, PLANE_TO_TRUE(backdrop.plane), src) - backdrop = mymob.overlay_fullscreen("lighting_backdrop_unlit#[offset]", /atom/movable/screen/fullscreen/lighting_backdrop/unlit) + backdrop = mymob.overlay_fullscreen("lighting_backdrop_unlit_[home.key]#[offset]", /atom/movable/screen/fullscreen/lighting_backdrop/unlit) SET_PLANE_EXPLICIT(backdrop, PLANE_TO_TRUE(backdrop.plane), src) // Sorry, this is a bit annoying @@ -166,13 +169,13 @@ if(hud) RegisterSignal(hud, COMSIG_HUD_OFFSET_CHANGED, PROC_REF(on_offset_change), override = TRUE) offset_change(hud?.current_plane_offset || 0) - set_alpha(mymob.lighting_alpha) + set_light_cutoff(mymob.lighting_cutoff, mymob.lighting_color_cutoffs) /atom/movable/screen/plane_master/rendering_plate/lighting/hide_from(mob/oldmob) . = ..() - oldmob.clear_fullscreen("lighting_backdrop_lit") - oldmob.clear_fullscreen("lighting_backdrop_unlit") + oldmob.clear_fullscreen("lighting_backdrop_lit_[home.key]#[offset]") + oldmob.clear_fullscreen("lighting_backdrop_unlit_[home.key]#[offset]") var/datum/hud/hud = home.our_hud if(hud) UnregisterSignal(hud, COMSIG_HUD_OFFSET_CHANGED, PROC_REF(on_offset_change)) @@ -188,6 +191,24 @@ else enable_alpha() +/atom/movable/screen/plane_master/rendering_plate/lighting/proc/set_light_cutoff(light_cutoff, list/color_cutoffs) + var/list/new_cutoffs = list(light_cutoff) + new_cutoffs += color_cutoffs + if(new_cutoffs ~= light_cutoffs) + return + + remove_filter(list("light_cutdown", "light_cutup")) + + var/ratio = light_cutoff/100 + if(!color_cutoffs) + color_cutoffs = list(0, 0, 0) + + var/red = color_cutoffs[1] / 100 + var/green = color_cutoffs[2] / 100 + var/blue = color_cutoffs[3] / 100 + add_filter("light_cutdown", 3, color_matrix_filter(list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, -(ratio + red),-(ratio+green),-(ratio+blue),0))) + add_filter("light_cutup", 4, color_matrix_filter(list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, ratio+red,ratio+green,ratio+blue,0))) + /atom/movable/screen/plane_master/rendering_plate/emissive_slate name = "Emissive Plate" documentation = "This system works by exploiting BYONDs color matrix filter to use layers to handle emissive blockers.\ @@ -206,26 +227,60 @@ /atom/movable/screen/plane_master/rendering_plate/emissive_slate/Initialize(mapload, datum/plane_master_group/home, offset) . = ..() - add_filter("emissive_mask", 1, alpha_mask_filter(render_source = OFFSET_RENDER_TARGET(EMISSIVE_MASK_RENDER_TARGET, offset))) add_filter("em_block_masking", 2, color_matrix_filter(GLOB.em_mask_matrix)) if(offset != 0) add_relay_to(GET_NEW_PLANE(EMISSIVE_RENDER_PLATE, offset - 1), relay_layer = EMISSIVE_Z_BELOW_LAYER) -/atom/movable/screen/plane_master/rendering_plate/mask_emissive - name = "Emissive Mask" - documentation = "Any part of this plane that is transparent will be transparent in the emissive plane.\ -
This is done to ensure emissives don't light things up \"through\" the darkness that normally sits at the bottom of the lighting plane.\ -
We relay copies of the space, floor and wall planes to it, so we can use them as masks. Then we just boost any existing alpha to 100% and we're done." - plane = EMISSIVE_MASK_PLANE +/atom/movable/screen/plane_master/rendering_plate/light_mask + name = "Light Mask" + documentation = "Any part of this plane that is transparent will be black below it on the game rendering plate.\ +
This is done to ensure emissives and overlay lights don't light things up \"through\" the darkness that normally sits at the bottom of the lighting plane.\ +
We relay copies of the space, floor and wall planes to it, so we can use them as masks. Then we just boost any existing alpha to 100% and we're done.\ +
If we ever switch to a sight setup that shows say, mobs but not floors, we instead mask just overlay lighting and emissives.\ +
This avoids dumb seethrough without breaking stuff like thermals." + plane = LIGHT_MASK_PLANE appearance_flags = PLANE_MASTER|NO_CLIENT_COLOR + // Fullwhite where there's any color, no alpha otherwise + color = list(255,255,255,255, 255,255,255,255, 255,255,255,255, 0,0,0,0, 0,0,0,0) mouse_opacity = MOUSE_OPACITY_TRANSPARENT - render_target = EMISSIVE_MASK_RENDER_TARGET - render_relay_planes = list() + render_target = LIGHT_MASK_RENDER_TARGET + // We blend against the game plane, so she's gotta multiply! + blend_mode = BLEND_MULTIPLY + render_relay_planes = list(RENDER_PLANE_GAME) -/atom/movable/screen/plane_master/rendering_plate/mask_emissive/Initialize(mapload, datum/plane_master_group/home, offset) +/atom/movable/screen/plane_master/rendering_plate/light_mask/show_to(mob/mymob) . = ..() - // Uses a filter cause the alpha slider will fuck up colors and we want to be editable - add_filter("pump_alpha", 1, color_matrix_filter(list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,255, 0,0,0,0))) + if(!.) + return + + RegisterSignal(mymob, COMSIG_MOB_SIGHT_CHANGE, PROC_REF(handle_sight)) + handle_sight(mymob, mymob.sight, NONE) + +/atom/movable/screen/plane_master/rendering_plate/light_mask/hide_from(mob/oldmob) + . = ..() + var/atom/movable/screen/plane_master/overlay_lights = home.get_plane(GET_NEW_PLANE(O_LIGHTING_VISUAL_PLANE, offset)) + overlay_lights.remove_filter("lighting_mask") + var/atom/movable/screen/plane_master/emissive = home.get_plane(GET_NEW_PLANE(EMISSIVE_RENDER_PLATE, offset)) + emissive.remove_filter("lighting_mask") + remove_relay_from(GET_NEW_PLANE(RENDER_PLANE_GAME, offset)) + UnregisterSignal(oldmob, COMSIG_MOB_SIGHT_CHANGE) + +/atom/movable/screen/plane_master/rendering_plate/light_mask/proc/handle_sight(datum/source, new_sight, old_sight) + // If we can see something that shows "through" blackness, and we can't see turfs, disable our draw to the game plane + // And instead mask JUST the overlay lighting plane, since that will look fuckin wrong + var/atom/movable/screen/plane_master/overlay_lights = home.get_plane(GET_NEW_PLANE(O_LIGHTING_VISUAL_PLANE, offset)) + var/atom/movable/screen/plane_master/emissive = home.get_plane(GET_NEW_PLANE(EMISSIVE_RENDER_PLATE, offset)) + if(new_sight & SEE_AVOID_TURF_BLACKNESS && !(new_sight & SEE_TURFS)) + remove_relay_from(GET_NEW_PLANE(RENDER_PLANE_GAME, offset)) + overlay_lights.add_filter("lighting_mask", 1, alpha_mask_filter(render_source = OFFSET_RENDER_TARGET(LIGHT_MASK_RENDER_TARGET, offset))) + emissive.add_filter("lighting_mask", 1, alpha_mask_filter(render_source = OFFSET_RENDER_TARGET(LIGHT_MASK_RENDER_TARGET, offset))) + // If we CAN'T see through the black, then draw er down brother! + else + overlay_lights.remove_filter("lighting_mask") + emissive.remove_filter("lighting_mask") + // We max alpha here, so our darkness is actually.. dark + // Can't do it before cause it fucks with the filter + add_relay_to(GET_NEW_PLANE(RENDER_PLANE_GAME, offset), relay_color = list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,1)) ///render plate for OOC stuff like ghosts, hud-screen effects, etc /atom/movable/screen/plane_master/rendering_plate/non_game diff --git a/code/datums/actions/mobs/adjust_vision.dm b/code/datums/actions/mobs/adjust_vision.dm index f595ef3e4b3..009bd7b1c01 100644 --- a/code/datums/actions/mobs/adjust_vision.dm +++ b/code/datums/actions/mobs/adjust_vision.dm @@ -1,4 +1,9 @@ +#define VISION_ACTION_LIGHT_OFF 0 +#define VISION_ACTION_LIGHT_LOW 1 +#define VISION_ACTION_LIGHT_MID 2 +#define VISION_ACTION_LIGHT_HIG 3 + /datum/action/adjust_vision name = "Adjust Vision" desc = "See better in the dark. Or don't. Your advanced vision allows either." @@ -7,32 +12,63 @@ background_icon_state = "bg_default" overlay_icon_state = "bg_default_border" + + // These lists are used as the color cutoff for the action + // They need to be filled out for subtypes + var/list/low_light_cutoff + var/list/medium_light_cutoff + var/list/high_light_cutoff + var/light_level = VISION_ACTION_LIGHT_OFF + /datum/action/adjust_vision/Grant(mob/living/grant_to) . = ..() - grant_to.see_in_dark = NIGHTVISION_FOV_RANGE - grant_to.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - grant_to.update_sight() + set_light_level(VISION_ACTION_LIGHT_LOW) + RegisterSignal(grant_to, COMSIG_MOB_UPDATE_SIGHT, PROC_REF(on_update_sight)) /datum/action/adjust_vision/Remove(mob/living/remove_from) + set_light_level(VISION_ACTION_LIGHT_OFF) + UnregisterSignal(remove_from, COMSIG_MOB_UPDATE_SIGHT) . = ..() - remove_from.see_in_dark = initial(remove_from.see_in_dark) - remove_from.lighting_alpha = initial(remove_from.lighting_alpha) - remove_from.update_sight() /datum/action/adjust_vision/Trigger(trigger_flags) . = ..() if(!.) return - var/mob/living/living_owner = owner - living_owner.sight = initial(living_owner.sight) - switch(living_owner.lighting_alpha) - if (LIGHTING_PLANE_ALPHA_VISIBLE) - living_owner.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) - living_owner.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) - living_owner.lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + switch(light_level) + if (VISION_ACTION_LIGHT_OFF) + set_light_level(VISION_ACTION_LIGHT_LOW) + if (VISION_ACTION_LIGHT_LOW) + set_light_level(VISION_ACTION_LIGHT_MID) + if (VISION_ACTION_LIGHT_MID) + set_light_level(VISION_ACTION_LIGHT_HIG) else - living_owner.lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE - living_owner.update_sight() + set_light_level(VISION_ACTION_LIGHT_OFF) + +/datum/action/adjust_vision/proc/set_light_level(new_level) + light_level = new_level + owner.update_sight() + +/datum/action/adjust_vision/proc/on_update_sight(datum/source) + SIGNAL_HANDLER + var/list/color_from + switch(light_level) + if (VISION_ACTION_LIGHT_LOW) + color_from = low_light_cutoff + if (VISION_ACTION_LIGHT_MID) + color_from = medium_light_cutoff + if (VISION_ACTION_LIGHT_HIG) + color_from = high_light_cutoff + else // just in case + color_from = list(0, 0, 0) + owner.lighting_color_cutoffs = blend_cutoff_colors(owner.lighting_color_cutoffs, color_from.Copy()) + +/datum/action/adjust_vision/bileworm + low_light_cutoff = list(18, 12, 0) + medium_light_cutoff = list(30, 20, 5) + high_light_cutoff = list(45, 30, 10) + +#undef VISION_ACTION_LIGHT_OFF +#undef VISION_ACTION_LIGHT_LOW +#undef VISION_ACTION_LIGHT_MID +#undef VISION_ACTION_LIGHT_HIG diff --git a/code/datums/brain_damage/imaginary_friend.dm b/code/datums/brain_damage/imaginary_friend.dm index f8bf0476095..57c3387e87e 100644 --- a/code/datums/brain_damage/imaginary_friend.dm +++ b/code/datums/brain_damage/imaginary_friend.dm @@ -60,8 +60,6 @@ real_name = "imaginary friend" move_on_shuttle = TRUE desc = "A wonderful yet fake friend." - see_in_dark = 0 - lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE sight = NONE mouse_opacity = MOUSE_OPACITY_ICON see_invisible = SEE_INVISIBLE_LIVING diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 9e42adcda2b..2def3515b08 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -348,6 +348,8 @@ var/filter = get_filter(name) if(!filter) return + // This can get injected by the filter procs, we want to support them so bye byeeeee + new_params -= "type" animate(filter, new_params, time = time, easing = easing, loop = loop) modify_filter(name, new_params) diff --git a/code/datums/quirks/positive_quirks.dm b/code/datums/quirks/positive_quirks.dm index b6ba13a4c86..ab4ce99c99c 100644 --- a/code/datums/quirks/positive_quirks.dm +++ b/code/datums/quirks/positive_quirks.dm @@ -202,7 +202,7 @@ /datum/quirk/night_vision/proc/refresh_quirk_holder_eyes() var/mob/living/carbon/human/human_quirk_holder = quirk_holder var/obj/item/organ/internal/eyes/eyes = human_quirk_holder.getorgan(/obj/item/organ/internal/eyes) - if(!eyes || eyes.lighting_alpha) + if(!eyes || eyes.lighting_cutoff) return // We've either added or removed TRAIT_NIGHT_VISION before calling this proc. Just refresh the eyes. eyes.refresh() diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index 90486bc8e5c..01e47b7a4bd 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -323,8 +323,6 @@ /datum/status_effect/cultghost/on_apply() owner.set_invis_see(SEE_INVISIBLE_OBSERVER) - owner.set_see_in_dark(2) - return TRUE /datum/status_effect/cultghost/tick() if(owner.reagents) diff --git a/code/datums/visual_data.dm b/code/datums/visual_data.dm index ca4aecfe429..75de75f4871 100644 --- a/code/datums/visual_data.dm +++ b/code/datums/visual_data.dm @@ -11,8 +11,6 @@ var/sight = NONE /// see_invisible values var/see_invis - /// see_in_dark values - var/see_dark /// What the client is seeing "out of", client.eye var/datum/weakref/client_eye /// Weakref to the mob we're mirroring off @@ -31,8 +29,6 @@ sight_changed(mirror_off) RegisterSignal(mirror_off, COMSIG_MOB_SEE_INVIS_CHANGE, PROC_REF(invis_changed)) invis_changed(mirror_off) - RegisterSignal(mirror_off, COMSIG_MOB_SEE_IN_DARK_CHANGE, PROC_REF(in_dark_changed)) - in_dark_changed(mirror_off) RegisterSignal(mirror_off, COMSIG_MOB_LOGIN, PROC_REF(on_login)) RegisterSignal(mirror_off, COMSIG_MOB_LOGOUT, PROC_REF(on_logout)) if(mirror_off.client) @@ -43,7 +39,6 @@ // Note: we explicitly do NOT use setters here, since it would break the behavior paint_to.sight = sight paint_to.see_invisible = see_invis - paint_to.see_in_dark = see_dark if(paint_to.client) var/atom/eye = client_eye?.resolve() if(eye) @@ -67,11 +62,6 @@ see_invis = source.see_invisible on_update() -/datum/visual_data/proc/in_dark_changed(mob/source) - SIGNAL_HANDLER - see_dark = source.see_in_dark - on_update() - /datum/visual_data/proc/on_login(mob/source) SIGNAL_HANDLER // visual data can be created off login, so conflicts here are inevitable diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index f2f82775943..ac09a940ed5 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -586,9 +586,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0) user.set_invis_see(SEE_INVISIBLE_LIVING) //can't see ghosts through cameras if(isXRay()) user.add_sight(SEE_TURFS|SEE_MOBS|SEE_OBJS) - user.set_see_in_dark(max(user.see_in_dark, 8)) else user.clear_sight(SEE_TURFS|SEE_MOBS|SEE_OBJS) - user.sight = 0 - user.set_see_in_dark(2) return 1 diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm index 984c02c2768..2cfcb2393a8 100644 --- a/code/game/machinery/computer/camera_advanced.dm +++ b/code/game/machinery/computer/camera_advanced.dm @@ -198,7 +198,6 @@ /mob/camera/ai_eye/remote/update_remote_sight(mob/living/user) user.set_invis_see(SEE_INVISIBLE_LIVING) //can't see ghosts through cameras user.set_sight(SEE_TURFS) - user.set_see_in_dark(2) return TRUE /mob/camera/ai_eye/remote/Destroy() diff --git a/code/game/machinery/dna_infuser/organ_sets/goliath_organs.dm b/code/game/machinery/dna_infuser/organ_sets/goliath_organs.dm index f715a694463..c5032ed5e2e 100644 --- a/code/game/machinery/dna_infuser/organ_sets/goliath_organs.dm +++ b/code/game/machinery/dna_infuser/organ_sets/goliath_organs.dm @@ -32,6 +32,11 @@ eye_color_left = "#FF0000" eye_color_right = "#FF0000" + low_light_cutoff = list(15, 0, 8) + medium_light_cutoff = list(35, 15, 25) + high_light_cutoff = list(50, 10, 40) + organ_traits = list(TRAIT_UNNATURAL_RED_GLOWY_EYES) + /obj/item/organ/internal/eyes/night_vision/goliath/Initialize(mapload) . = ..() AddElement(/datum/element/noticable_organ, "eyes are blood red and stone-like.", BODY_ZONE_PRECISE_EYES) diff --git a/code/game/machinery/dna_infuser/organ_sets/rat_organs.dm b/code/game/machinery/dna_infuser/organ_sets/rat_organs.dm index c35f8fc1568..414ca0b1622 100644 --- a/code/game/machinery/dna_infuser/organ_sets/rat_organs.dm +++ b/code/game/machinery/dna_infuser/organ_sets/rat_organs.dm @@ -33,6 +33,9 @@ icon_state = "eyes" greyscale_config = /datum/greyscale_config/mutant_organ greyscale_colors = RAT_COLORS + low_light_cutoff = list(16, 11, 0) + medium_light_cutoff = list(30, 20, 5) + high_light_cutoff = list(45, 35, 10) /obj/item/organ/internal/eyes/night_vision/rat/Initialize(mapload) . = ..() diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm index 9e779d5d9c3..606f09ee9f0 100644 --- a/code/game/turfs/open/openspace.dm +++ b/code/game/turfs/open/openspace.dm @@ -1,12 +1,15 @@ /turf/open/openspace name = "open space" desc = "Watch your step!" - icon_state = "invisible" + // We don't actually draw openspace, but it needs to have color + // In its icon state so we can count it as a "non black" tile + icon_state = MAP_SWITCH("pure_white", "invisible") baseturfs = /turf/open/openspace overfloor_placed = FALSE underfloor_accessibility = UNDERFLOOR_INTERACTABLE mouse_opacity = MOUSE_OPACITY_TRANSPARENT pathing_pass_method = TURF_PATHING_PASS_PROC + plane = TRANSPARENT_FLOOR_PLANE var/can_cover_up = TRUE var/can_build_on = TRUE diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm index b16534c88fa..1e98db673ea 100644 --- a/code/game/turfs/open/space/space.dm +++ b/code/game/turfs/open/space/space.dm @@ -233,13 +233,15 @@ /turf/open/space/openspace icon = 'icons/turf/floors.dmi' - icon_state = "invisible" - plane = FLOOR_PLANE + icon_state = MAP_SWITCH("pure_white", "invisible") + plane = TRANSPARENT_FLOOR_PLANE /turf/open/space/openspace/Initialize(mapload) // handle plane and layer here so that they don't cover other obs/turfs in Dream Maker . = ..() - icon_state = "invisible" - update_starlight() + icon_state = "pure_white" + // We make the assumption that the space plane will never be blacklisted, as an optimization + if(SSmapping.max_plane_offset) + plane = TRANSPARENT_FLOOR_PLANE - (PLANE_RANGE * SSmapping.z_level_to_plane_offset[z]) return INITIALIZE_HINT_LATELOAD /turf/open/space/openspace/LateInitialize() diff --git a/code/modules/admin/verbs/admingame.dm b/code/modules/admin/verbs/admingame.dm index 8e8ae1f00cd..2027e3cfb8c 100644 --- a/code/modules/admin/verbs/admingame.dm +++ b/code/modules/admin/verbs/admingame.dm @@ -391,7 +391,7 @@ Traitors and the like can also be revived with the previous role mostly intact. for (var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud in GLOB.active_alternate_appearances) antag_hud.show_to(mob) - mob.lighting_alpha = mob.default_lighting_alpha() + mob.lighting_cutoff = mob.default_lighting_cutoff() mob.update_sight() /client/proc/disable_combo_hud() @@ -407,7 +407,7 @@ Traitors and the like can also be revived with the previous role mostly intact. for (var/datum/atom_hud/alternate_appearance/basic/antagonist_hud/antag_hud in GLOB.active_alternate_appearances) antag_hud.hide_from(mob) - mob.lighting_alpha = mob.default_lighting_alpha() + mob.lighting_cutoff = mob.default_lighting_cutoff() mob.update_sight() /datum/admins/proc/show_traitor_panel(mob/target_mob in GLOB.mob_list) diff --git a/code/modules/antagonists/blob/overmind.dm b/code/modules/antagonists/blob/overmind.dm index b814ff037f6..021c8bb12d5 100644 --- a/code/modules/antagonists/blob/overmind.dm +++ b/code/modules/antagonists/blob/overmind.dm @@ -13,14 +13,16 @@ GLOBAL_LIST_EMPTY(blob_nodes) icon_state = "marker" mouse_opacity = MOUSE_OPACITY_ICON move_on_shuttle = 1 - see_in_dark = NIGHTVISION_FOV_RANGE invisibility = INVISIBILITY_OBSERVER layer = FLY_LAYER plane = ABOVE_GAME_PLANE see_invisible = SEE_INVISIBLE_LIVING pass_flags = PASSBLOB faction = list(ROLE_BLOB) - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Vivid blue green, would be cool to make this change with strain + lighting_cutoff_red = 0 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 20 hud_type = /datum/hud/blob_overmind var/obj/structure/blob/special/core/blob_core = null // The blob overmind's core var/blob_points = 0 diff --git a/code/modules/antagonists/disease/disease_mob.dm b/code/modules/antagonists/disease/disease_mob.dm index 5e6ed7222ce..18c957c28fd 100644 --- a/code/modules/antagonists/disease/disease_mob.dm +++ b/code/modules/antagonists/disease/disease_mob.dm @@ -15,11 +15,13 @@ the new instance inside the host to be updated to the template's stats. icon_state = "marker" mouse_opacity = MOUSE_OPACITY_ICON move_on_shuttle = FALSE - see_in_dark = NIGHTVISION_FOV_RANGE invisibility = INVISIBILITY_OBSERVER see_invisible = SEE_INVISIBLE_LIVING layer = BELOW_MOB_LAYER - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Pale green, bright enough to have good vision + lighting_cutoff_red = 5 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 20 sight = SEE_SELF|SEE_THRU initial_language_holder = /datum/language_holder/universal diff --git a/code/modules/antagonists/malf_ai/malf_ai_modules.dm b/code/modules/antagonists/malf_ai/malf_ai_modules.dm index 7cdad01d613..3ebc3a245f3 100644 --- a/code/modules/antagonists/malf_ai/malf_ai_modules.dm +++ b/code/modules/antagonists/malf_ai/malf_ai_modules.dm @@ -801,7 +801,8 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) unlock_sound = 'sound/items/rped.ogg' /datum/ai_module/upgrade/upgrade_cameras/upgrade(mob/living/silicon/ai/AI) - AI.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE //Night-vision, without which X-ray would be very limited in power. + // Sets up nightvision + RegisterSignal(AI, COMSIG_MOB_UPDATE_SIGHT, PROC_REF(on_update_sight)) AI.update_sight() var/upgraded_cameras = 0 @@ -826,6 +827,11 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) upgraded_cameras++ unlock_text = replacetext(unlock_text, "CAMSUPGRADED", "[upgraded_cameras]") //This works, since unlock text is called after upgrade() +/datum/ai_module/upgrade/upgrade_cameras/proc/on_update_sight(mob/source) + SIGNAL_HANDLER + // Dim blue, pretty + source.lighting_color_cutoffs = blend_cutoff_colors(source.lighting_color_cutoffs, list(5, 25, 35)) + /// AI Turret Upgrade: Increases the health and damage of all turrets. /datum/ai_module/upgrade/upgrade_turrets name = "AI Turret Upgrade" diff --git a/code/modules/antagonists/revenant/revenant_abilities.dm b/code/modules/antagonists/revenant/revenant_abilities.dm index f0d219a520c..fd3cd2376b5 100644 --- a/code/modules/antagonists/revenant/revenant_abilities.dm +++ b/code/modules/antagonists/revenant/revenant_abilities.dm @@ -116,16 +116,6 @@ draining = FALSE essence_drained = 0 -//Toggle night vision: lets the revenant toggle its night vision -/datum/action/cooldown/spell/night_vision/revenant - name = "Toggle Darkvision" - panel = "Revenant Abilities" - background_icon_state = "bg_revenant" - overlay_icon_state = "bg_revenant_border" - button_icon = 'icons/mob/actions/actions_revenant.dmi' - button_icon_state = "r_nightvision" - toggle_span = "revennotice" - //Transmit: the revemant's only direct way to communicate. Sends a single message silently to a single mob /datum/action/cooldown/spell/list_target/telepathy/revenant name = "Revenant Transmit" diff --git a/code/modules/cargo/bounties/special.dm b/code/modules/cargo/bounties/special.dm index 6fefa572a52..268ac2ea033 100644 --- a/code/modules/cargo/bounties/special.dm +++ b/code/modules/cargo/bounties/special.dm @@ -9,7 +9,7 @@ /obj/item/organ/internal/body_egg/alien_embryo = TRUE, /obj/item/organ/internal/liver/alien = TRUE, /obj/item/organ/internal/tongue/alien = TRUE, - /obj/item/organ/internal/eyes/night_vision/alien = TRUE, + /obj/item/organ/internal/eyes/alien = TRUE, ) /datum/bounty/item/syndicate_documents diff --git a/code/modules/client/preferences/ghost_lighting.dm b/code/modules/client/preferences/ghost_lighting.dm index 05339859d3f..a116d3d2f09 100644 --- a/code/modules/client/preferences/ghost_lighting.dm +++ b/code/modules/client/preferences/ghost_lighting.dm @@ -1,8 +1,8 @@ GLOBAL_LIST_INIT(ghost_lighting_options, list( - "Fullbright" = LIGHTING_PLANE_ALPHA_INVISIBLE, - "Night Vision" = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE, - "Darker" = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE, - "Normal" = LIGHTING_PLANE_ALPHA_VISIBLE, + "Fullbright" = LIGHTING_CUTOFF_FULLBRIGHT, + "Night Vision" = LIGHTING_CUTOFF_HIGH, + "Darker" = LIGHTING_CUTOFF_MEDIUM, + "Normal" = LIGHTING_CUTOFF_VISIBLE, )) /// How bright a ghost's lighting plane is @@ -24,5 +24,5 @@ GLOBAL_LIST_INIT(ghost_lighting_options, list( var/mob/current_mob = client?.mob if(!isobserver(current_mob)) return - current_mob.lighting_alpha = current_mob.default_lighting_alpha() + current_mob.lighting_cutoff = current_mob.default_lighting_cutoff() current_mob.update_sight() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index a4a36cf45ad..e4ee5c90213 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -15,7 +15,7 @@ var/visor_flags_inv = 0 //same as visor_flags, but for flags_inv var/visor_flags_cover = 0 //same as above, but for flags_cover ///What to toggle when toggled with weldingvisortoggle() - var/visor_vars_to_toggle = VISOR_FLASHPROTECT | VISOR_TINT | VISOR_VISIONFLAGS | VISOR_DARKNESSVIEW | VISOR_INVISVIEW + var/visor_vars_to_toggle = VISOR_FLASHPROTECT | VISOR_TINT | VISOR_VISIONFLAGS | VISOR_INVISVIEW var/clothing_flags = NONE ///List of items that can be equipped in the suit storage slot while we're worn. diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 05592fc4314..be3b7b0c778 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -13,13 +13,22 @@ custom_materials = list(/datum/material/glass = 250) gender = PLURAL var/vision_flags = 0 - var/darkness_view = 2 // Base human is 2 var/invis_view = SEE_INVISIBLE_LIVING // Admin only for now /// Override to allow glasses to set higher than normal see_invis var/invis_override = 0 - var/lighting_alpha + /// A percentage of how much rgb to "max" on the lighting plane + /// This lets us brighten darkness without washing out bright color + var/lighting_cutoff = null + /// Similar to lighting_cutoff, except it has individual r g and b components in the same 0-100 scale + var/list/color_cutoffs = null /// The current hud icons var/list/icon/current = list() +// Potentially replace glass_color_type with a setup that colors lighting by dropping segments of different componets +// Like the current idea, but applied without the mass cutoff (maybe? somehow?) +// That or just a light color to the lighting plane, that'd work too +// Enough to make it visible but not so much that it's a pain + +// That, or just make stuff that uses lighting_cutoff have colored offsets and all, like you were planning /// Colors your vision when worn var/glass_colour_type /// Whether or not vision coloring is forcing @@ -38,8 +47,6 @@ ..() if(visor_vars_to_toggle & VISOR_VISIONFLAGS) vision_flags ^= initial(vision_flags) - if(visor_vars_to_toggle & VISOR_DARKNESSVIEW) - darkness_view ^= initial(darkness_view) if(visor_vars_to_toggle & VISOR_INVISVIEW) invis_view ^= initial(invis_view) @@ -107,9 +114,9 @@ icon_state = "meson" inhand_icon_state = "meson" clothing_traits = list(TRAIT_MADNESS_IMMUNE) - darkness_view = 2 vision_flags = SEE_TURFS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + // Mesons get to be lightly green + color_cutoffs = list(5, 15, 5) glass_colour_type = /datum/client_colour/glass_colour/lightgreen /obj/item/clothing/glasses/meson/suicide_act(mob/living/carbon/user) @@ -121,9 +128,9 @@ desc = "An optical meson scanner fitted with an amplified visible light spectrum overlay, providing greater visual clarity in darkness." icon_state = "nvgmeson" inhand_icon_state = "nvgmeson" - darkness_view = 8 flash_protect = FLASH_PROTECTION_SENSITIVE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Night vision mesons get the same but more intense + color_cutoffs = list(10, 30, 10) glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/meson/gar @@ -166,9 +173,9 @@ name = "night vision science goggles" desc = "Lets the user see in the dark and recognize chemical compounds at a glance." icon_state = "scihudnight" - darkness_view = 8 flash_protect = FLASH_PROTECTION_SENSITIVE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Real vivid purple + color_cutoffs = list(50, 10, 30) glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/night @@ -176,9 +183,9 @@ desc = "You can totally see in the dark now!" icon_state = "night" inhand_icon_state = "glasses" - darkness_view = 8 flash_protect = FLASH_PROTECTION_SENSITIVE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Dark green + color_cutoffs = list(10, 30, 10) glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/eyepatch @@ -219,7 +226,6 @@ desc = "Used by miners to detect ores deep within the rock." icon_state = "material" inhand_icon_state = "glasses" - darkness_view = 0 /obj/item/clothing/glasses/material/mining/gar name = "gar material scanner" @@ -315,7 +321,6 @@ desc = "Strangely ancient technology used to help provide rudimentary eye cover. Enhanced shielding blocks flashes." icon_state = "sun" inhand_icon_state = "sunglasses" - darkness_view = 1 flash_protect = FLASH_PROTECTION_FLASH tint = 1 glass_colour_type = /datum/client_colour/glass_colour/gray @@ -396,7 +401,6 @@ inhand_icon_state = "blindfold" flash_protect = FLASH_PROTECTION_WELDER tint = INFINITY // You WILL Be blind, no matter what - darkness_view = 1 dog_fashion = /datum/dog_fashion/head /obj/item/clothing/glasses/trickblindfold @@ -446,7 +450,8 @@ icon_state = "thermal" inhand_icon_state = "glasses" vision_flags = SEE_MOBS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + // Going for an orange color here + color_cutoffs = list(25, 8, 5) flash_protect = FLASH_PROTECTION_SENSITIVE glass_colour_type = /datum/client_colour/glass_colour/red @@ -570,9 +575,8 @@ icon_state = "nvgmeson" inhand_icon_state = "nvgmeson" flags_cover = GLASSESCOVERSEYES - darkness_view = 8 flash_protect = FLASH_PROTECTION_WELDER - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + lighting_cutoff = LIGHTING_CUTOFF_HIGH glass_colour_type = FALSE vision_flags = SEE_TURFS clothing_traits = list(TRAIT_REAGENT_SCANNER, TRAIT_MADNESS_IMMUNE) diff --git a/code/modules/clothing/glasses/engine_goggles.dm b/code/modules/clothing/glasses/engine_goggles.dm index 38a55df8aa3..2185dd19fde 100644 --- a/code/modules/clothing/glasses/engine_goggles.dm +++ b/code/modules/clothing/glasses/engine_goggles.dm @@ -21,8 +21,7 @@ gender = PLURAL vision_flags = NONE - darkness_view = 2 - lighting_alpha = null + color_cutoffs = null var/list/modes = list(MODE_NONE = MODE_MESON, MODE_MESON = MODE_TRAY, MODE_TRAY = MODE_NONE) var/mode = MODE_NONE @@ -47,14 +46,12 @@ switch(mode) if(MODE_MESON) vision_flags = SEE_TURFS - darkness_view = 1 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + color_cutoffs = list(15, 12, 0) change_glass_color(user, /datum/client_colour/glass_colour/yellow) if(MODE_TRAY) //undoes the last mode, meson vision_flags = NONE - darkness_view = 2 - lighting_alpha = null + color_cutoffs = list() change_glass_color(user, /datum/client_colour/glass_colour/lightblue) if(MODE_PIPE_CONNECTABLE) diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 8540e9b1912..2f5943f7908 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -67,9 +67,9 @@ desc = "An advanced medical heads-up display that allows doctors to find patients in complete darkness." icon_state = "healthhudnight" inhand_icon_state = "glasses" - darkness_view = 8 flash_protect = FLASH_PROTECTION_SENSITIVE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + // Blue green, dark + color_cutoffs = list(5, 15, 30) glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/hud/health/night/meson @@ -87,7 +87,6 @@ name = "medical HUDSunglasses" desc = "Sunglasses with a medical HUD." icon_state = "sunhudmed" - darkness_view = 1 flash_protect = FLASH_PROTECTION_FLASH tint = 1 glass_colour_type = /datum/client_colour/glass_colour/blue @@ -105,9 +104,9 @@ desc = "A robotics diagnostic HUD fitted with a light amplifier." icon_state = "diagnostichudnight" inhand_icon_state = "glasses" - darkness_view = 8 flash_protect = FLASH_PROTECTION_SENSITIVE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + // Pale yellow + color_cutoffs = list(30, 20, 5) glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/hud/diagnostic/sunglasses @@ -167,7 +166,6 @@ name = "security HUDSunglasses" desc = "Sunglasses with a security HUD." icon_state = "sunhudsec" - darkness_view = 1 flash_protect = FLASH_PROTECTION_FLASH tint = 1 glass_colour_type = /datum/client_colour/glass_colour/darkred @@ -176,9 +174,9 @@ name = "night vision security HUD" desc = "An advanced heads-up display that provides ID data and vision in complete darkness." icon_state = "securityhudnight" - darkness_view = 8 flash_protect = FLASH_PROTECTION_SENSITIVE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + // Red with a tint of green + color_cutoffs = list(35, 5, 5) glass_colour_type = /datum/client_colour/glass_colour/green /obj/item/clothing/glasses/hud/security/sunglasses/gars @@ -238,7 +236,7 @@ icon_state = "thermal" hud_type = DATA_HUD_SECURITY_ADVANCED vision_flags = SEE_MOBS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + color_cutoffs = list(25, 8, 5) glass_colour_type = /datum/client_colour/glass_colour/red /obj/item/clothing/glasses/hud/toggle/thermal/attack_self(mob/user) @@ -246,13 +244,17 @@ switch (hud_type) if (DATA_HUD_MEDICAL_ADVANCED) icon_state = "meson" + color_cutoffs = list(5, 15, 5) change_glass_color(user, /datum/client_colour/glass_colour/green) if (DATA_HUD_SECURITY_ADVANCED) icon_state = "thermal" + color_cutoffs = list(25, 8, 5) change_glass_color(user, /datum/client_colour/glass_colour/red) else icon_state = "purple" + color_cutoffs = list(15, 0, 25) change_glass_color(user, /datum/client_colour/glass_colour/purple) + user.update_sight() user.update_worn_glasses() /obj/item/clothing/glasses/hud/toggle/thermal/emp_act(severity) @@ -265,7 +267,6 @@ name = "police aviators" desc = "For thinking you look cool while brutalizing protestors and minorities." icon_state = "bigsunglasses" - darkness_view = 1 flash_protect = FLASH_PROTECTION_FLASH tint = 1 glass_colour_type = /datum/client_colour/glass_colour/gray diff --git a/code/modules/mining/lavaland/tendril_loot.dm b/code/modules/mining/lavaland/tendril_loot.dm index 24199de0f26..57b5bc84c25 100644 --- a/code/modules/mining/lavaland/tendril_loot.dm +++ b/code/modules/mining/lavaland/tendril_loot.dm @@ -277,7 +277,7 @@ layer = ABOVE_ALL_MOB_LAYER plane = ABOVE_GAME_PLANE var/sight_flags = SEE_MOBS - var/lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + var/list/color_cutoffs = list(10, 25, 25) /obj/effect/wisp/orbit(atom/thing, radius, clockwise, rotation_speed, rotation_segments, pre_rotation, lockinorbit) . = ..() @@ -296,8 +296,8 @@ /obj/effect/wisp/proc/update_user_sight(mob/user) SIGNAL_HANDLER user.add_sight(sight_flags) - if(!isnull(lighting_alpha)) - user.lighting_alpha = min(user.lighting_alpha, lighting_alpha) + if(!isnull(color_cutoffs)) + user.lighting_color_cutoffs = blend_cutoff_colors(user.lighting_color_cutoffs, color_cutoffs) //Red/Blue Cubes /obj/item/warp_cube @@ -795,8 +795,8 @@ icon_state = "godeye" inhand_icon_state = null vision_flags = SEE_TURFS - darkness_view = 8 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Blue, light blue + color_cutoffs = list(15, 30, 40) resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF custom_materials = null var/datum/action/cooldown/scan/scan_ability diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 8ba7dc8f8bc..8b314eb48b5 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -208,12 +208,16 @@ var/mob/living/simple_animal/hostile/mining_drone/user = owner if(user.sight & SEE_TURFS) user.clear_sight(SEE_TURFS) - user.lighting_alpha = initial(user.lighting_alpha) + user.lighting_cutoff_red += 5 + user.lighting_cutoff_green += 15 + user.lighting_cutoff_blue += 5 else user.add_sight(SEE_TURFS) - user.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + user.lighting_cutoff_red -= 5 + user.lighting_cutoff_green -= 15 + user.lighting_cutoff_blue -= 5 - user.sync_lighting_plane_alpha() + user.sync_lighting_plane_cutoff() to_chat(user, span_notice("You toggle your meson vision [(user.sight & SEE_TURFS) ? "on" : "off"].")) diff --git a/code/modules/mob/camera/camera.dm b/code/modules/mob/camera/camera.dm index 851fac29028..c9d44aa2973 100644 --- a/code/modules/mob/camera/camera.dm +++ b/code/modules/mob/camera/camera.dm @@ -6,7 +6,6 @@ move_resist = INFINITY status_flags = GODMODE // You can't damage it. mouse_opacity = MOUSE_OPACITY_TRANSPARENT - see_in_dark = 7 invisibility = INVISIBILITY_ABSTRACT // No one can see us sight = SEE_SELF move_on_shuttle = FALSE @@ -45,3 +44,7 @@ if(has_emotes) return ..() return FALSE + +/mob/camera/update_sight() + lighting_color_cutoffs = list(lighting_cutoff_red, lighting_cutoff_green, lighting_cutoff_blue) + return ..() diff --git a/code/modules/mob/dead/observer/login.dm b/code/modules/mob/dead/observer/login.dm index 66c30561836..4135f8d22fa 100644 --- a/code/modules/mob/dead/observer/login.dm +++ b/code/modules/mob/dead/observer/login.dm @@ -21,7 +21,7 @@ update_icon(ALL, preferred_form) updateghostimages() client.set_right_click_menu_mode(FALSE) - lighting_alpha = default_lighting_alpha() + lighting_cutoff = default_lighting_cutoff() update_sight() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 36c985963e4..38a7a224344 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -12,8 +12,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) stat = DEAD density = FALSE see_invisible = SEE_INVISIBLE_OBSERVER - see_in_dark = 100 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + lighting_cutoff = LIGHTING_CUTOFF_MEDIUM invisibility = INVISIBILITY_OBSERVER hud_type = /datum/hud/ghost movement_type = GROUND | FLYING @@ -616,15 +615,15 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/verb/toggle_darkness() set name = "Toggle Darkness" set category = "Ghost" - switch(lighting_alpha) - if (LIGHTING_PLANE_ALPHA_VISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + switch(lighting_cutoff) + if (LIGHTING_CUTOFF_VISIBLE) + lighting_cutoff = LIGHTING_CUTOFF_MEDIUM + if (LIGHTING_CUTOFF_MEDIUM) + lighting_cutoff = LIGHTING_CUTOFF_HIGH + if (LIGHTING_CUTOFF_HIGH) + lighting_cutoff = LIGHTING_CUTOFF_FULLBRIGHT else - lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE + lighting_cutoff = LIGHTING_CUTOFF_VISIBLE update_sight() @@ -1071,7 +1070,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp else client.images -= stored_t_ray_images -/mob/dead/observer/default_lighting_alpha() +/mob/dead/observer/default_lighting_cutoff() var/datum/preferences/prefs = client?.prefs if(!prefs || (client?.combo_hud_enabled && prefs.toggles & COMBOHUD_LIGHTING)) return ..() diff --git a/code/modules/mob/living/basic/basic.dm b/code/modules/mob/living/basic/basic.dm index 0473c09973c..64fde221e40 100644 --- a/code/modules/mob/living/basic/basic.dm +++ b/code/modules/mob/living/basic/basic.dm @@ -166,6 +166,10 @@ if(!(basic_mob_flags & REMAIN_DENSE_WHILE_DEAD)) set_density(initial(density)) +/mob/living/basic/update_sight() + lighting_color_cutoffs = list(lighting_cutoff_red, lighting_cutoff_green, lighting_cutoff_blue) + return ..() + /mob/living/basic/proc/melee_attack(atom/target, list/modifiers) face_atom(target) if(SEND_SIGNAL(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, target) & COMPONENT_HOSTILE_NO_ATTACK) diff --git a/code/modules/mob/living/basic/farm_animals/cow/_cow.dm b/code/modules/mob/living/basic/farm_animals/cow/_cow.dm index f4e4aa908e0..4c80cc4f8b5 100644 --- a/code/modules/mob/living/basic/farm_animals/cow/_cow.dm +++ b/code/modules/mob/living/basic/farm_animals/cow/_cow.dm @@ -11,7 +11,6 @@ mob_biotypes = MOB_ORGANIC | MOB_BEAST speak_emote = list("moos","moos hauntingly") speed = 1.1 - see_in_dark = 6 butcher_results = list(/obj/item/food/meat/slab = 6) response_help_continuous = "pets" response_help_simple = "pet" diff --git a/code/modules/mob/living/basic/farm_animals/pig.dm b/code/modules/mob/living/basic/farm_animals/pig.dm index bf9831db0f7..e931a549122 100644 --- a/code/modules/mob/living/basic/farm_animals/pig.dm +++ b/code/modules/mob/living/basic/farm_animals/pig.dm @@ -9,7 +9,6 @@ gender = MALE mob_biotypes = MOB_ORGANIC | MOB_BEAST speak_emote = list("oinks","squees") - see_in_dark = 6 butcher_results = list(/obj/item/food/meat/slab/pig = 6) response_help_continuous = "pets" response_help_simple = "pet" diff --git a/code/modules/mob/living/basic/farm_animals/sheep.dm b/code/modules/mob/living/basic/farm_animals/sheep.dm index 95e1a6737df..4102bd83fdf 100644 --- a/code/modules/mob/living/basic/farm_animals/sheep.dm +++ b/code/modules/mob/living/basic/farm_animals/sheep.dm @@ -9,7 +9,6 @@ mob_biotypes = MOB_ORGANIC | MOB_BEAST speak_emote = list("baas","bleats") speed = 1.1 - see_in_dark = 6 butcher_results = list(/obj/item/food/meat/slab = 3) response_help_continuous = "pets" response_help_simple = "pet" diff --git a/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm b/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm index cfc1cd2db0b..ae87d20b371 100644 --- a/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm +++ b/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm @@ -54,7 +54,7 @@ resurface.Grant(src) var/datum/action/cooldown/mob_cooldown/devour/devour = new(src) devour.Grant(src) - var/datum/action/adjust_vision/adjust_vision = new(src) + var/datum/action/adjust_vision/bileworm/adjust_vision = new(src) adjust_vision.Grant(src) ai_controller.blackboard[BB_BILEWORM_SPEW_BILE] = spew_bile ai_controller.blackboard[BB_BILEWORM_RESURFACE] = resurface diff --git a/code/modules/mob/living/basic/pets/dog.dm b/code/modules/mob/living/basic/pets/dog.dm index cc873f0a918..714f68c5afd 100644 --- a/code/modules/mob/living/basic/pets/dog.dm +++ b/code/modules/mob/living/basic/pets/dog.dm @@ -26,7 +26,6 @@ response_harm_simple = "kick" speak_emote = list("barks", "woofs") faction = list(FACTION_NEUTRAL) - see_in_dark = 5 can_be_held = TRUE ai_controller = /datum/ai_controller/basic_controller/dog // The dog attack pet command can raise melee attack above 0 diff --git a/code/modules/mob/living/basic/space_fauna/netherworld/migo.dm b/code/modules/mob/living/basic/space_fauna/netherworld/migo.dm index 3f9f5d25c5a..d6ba8ab0fd4 100644 --- a/code/modules/mob/living/basic/space_fauna/netherworld/migo.dm +++ b/code/modules/mob/living/basic/space_fauna/netherworld/migo.dm @@ -22,6 +22,10 @@ unsuitable_atmos_damage = 0 unsuitable_cold_damage = 0 unsuitable_heat_damage = 0 + // Real blue, trying to go for the migo's look + lighting_cutoff_red = 15 + lighting_cutoff_green = 15 + lighting_cutoff_blue = 50 ai_controller = /datum/ai_controller/basic_controller/migo var/static/list/migo_sounds diff --git a/code/modules/mob/living/basic/vermin/mouse.dm b/code/modules/mob/living/basic/vermin/mouse.dm index b84d30f7d91..8f6a7f8d687 100644 --- a/code/modules/mob/living/basic/vermin/mouse.dm +++ b/code/modules/mob/living/basic/vermin/mouse.dm @@ -8,7 +8,6 @@ maxHealth = 5 health = 5 - see_in_dark = 6 density = FALSE pass_flags = PASSTABLE|PASSGRILLE|PASSMOB mob_size = MOB_SIZE_TINY diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 4f8cc38ea54..df0fd342f16 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -5,7 +5,6 @@ dna = null faction = list(ROLE_ALIEN) sight = SEE_MOBS - see_in_dark = 4 verb_say = "hisses" initial_language_holder = /datum/language_holder/alien bubble_icon = "alien" @@ -39,7 +38,7 @@ internal_organs += new /obj/item/organ/internal/brain/alien internal_organs += new /obj/item/organ/internal/alien/hivenode internal_organs += new /obj/item/organ/internal/tongue/alien - internal_organs += new /obj/item/organ/internal/eyes/night_vision/alien + internal_organs += new /obj/item/organ/internal/eyes/alien internal_organs += new /obj/item/organ/internal/liver/alien internal_organs += new /obj/item/organ/internal/ears ..() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 0950d621b56..a20b9259d16 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -561,20 +561,21 @@ set_sight(initial(sight)) else set_sight(SEE_TURFS|SEE_MOBS|SEE_OBJS) - set_see_in_dark(8) set_invis_see(SEE_INVISIBLE_OBSERVER) return var/new_sight = initial(sight) - lighting_alpha = initial(lighting_alpha) + lighting_cutoff = initial(lighting_cutoff) + lighting_color_cutoffs = list(lighting_cutoff_red, lighting_cutoff_green, lighting_cutoff_blue) var/obj/item/organ/internal/eyes/eyes = getorganslot(ORGAN_SLOT_EYES) if(eyes) set_invis_see(eyes.see_invisible) - set_see_in_dark(eyes.see_in_dark) new_sight |= eyes.sight_flags - if(!isnull(eyes.lighting_alpha)) - lighting_alpha = eyes.lighting_alpha + if(!isnull(eyes.lighting_cutoff)) + lighting_cutoff = eyes.lighting_cutoff + if(!isnull(eyes.color_cutoffs)) + lighting_color_cutoffs = blend_cutoff_colors(lighting_color_cutoffs, eyes.color_cutoffs) if(client.eye && client.eye != src) var/atom/A = client.eye @@ -582,31 +583,30 @@ return if(glasses) - var/obj/item/clothing/glasses/G = glasses - new_sight |= G.vision_flags - set_see_in_dark(max(G.darkness_view, see_in_dark)) - if(G.invis_override) - set_invis_see(G.invis_override) + new_sight |= glasses.vision_flags + if(glasses.invis_override) + set_invis_see(glasses.invis_override) else - set_invis_see(min(G.invis_view, see_invisible)) - if(!isnull(G.lighting_alpha)) - lighting_alpha = min(lighting_alpha, G.lighting_alpha) + set_invis_see(min(glasses.invis_view, see_invisible)) + if(!isnull(glasses.lighting_cutoff)) + lighting_cutoff = max(lighting_cutoff, glasses.lighting_cutoff) + if(!isnull(glasses.color_cutoffs)) + lighting_color_cutoffs = blend_cutoff_colors(lighting_color_cutoffs, glasses.color_cutoffs) + if(HAS_TRAIT(src, TRAIT_TRUE_NIGHT_VISION)) - lighting_alpha = min(lighting_alpha, LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) - set_see_in_dark(max(see_in_dark, 8)) + lighting_cutoff = max(lighting_cutoff, LIGHTING_CUTOFF_HIGH) if(HAS_TRAIT(src, TRAIT_MESON_VISION)) new_sight |= SEE_TURFS - lighting_alpha = min(lighting_alpha, LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) + lighting_cutoff = max(lighting_cutoff, LIGHTING_CUTOFF_MEDIUM) if(HAS_TRAIT(src, TRAIT_THERMAL_VISION)) new_sight |= SEE_MOBS - lighting_alpha = min(lighting_alpha, LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) + lighting_cutoff = max(lighting_cutoff, LIGHTING_CUTOFF_MEDIUM) if(HAS_TRAIT(src, TRAIT_XRAY_VISION)) new_sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS - set_see_in_dark(max(see_in_dark, 8)) if(see_override) set_invis_see(see_override) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 5ddd5700bc0..840bc0fef99 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -136,7 +136,7 @@ update_glasses_color(G, 1) if(G.tint) update_tint() - if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) + if(G.vision_flags || G.invis_override || G.invis_view || !isnull(G.lighting_cutoff)) update_sight() update_worn_glasses() if(ITEM_SLOT_GLOVES) @@ -258,7 +258,7 @@ update_glasses_color(G, 0) if(G.tint) update_tint() - if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) + if(G.vision_flags || G.invis_override || G.invis_view || !isnull(G.lighting_cutoff)) update_sight() if(!QDELETED(src)) update_worn_glasses() diff --git a/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm b/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm index 1479ab12131..29387bb6743 100644 --- a/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm @@ -18,7 +18,7 @@ changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC mutantbrain = /obj/item/organ/internal/brain/shadow - mutanteyes = /obj/item/organ/internal/eyes/night_vision/shadow + mutanteyes = /obj/item/organ/internal/eyes/shadow mutantheart = null mutantlungs = null @@ -105,8 +105,9 @@ else if (light_amount < SHADOW_SPECIES_LIGHT_THRESHOLD) //heal in the dark owner.heal_overall_damage(brute = 0.5 * delta_time, burn = 0.5 * delta_time, required_bodytype = BODYTYPE_ORGANIC) -/obj/item/organ/internal/eyes/night_vision/shadow +/obj/item/organ/internal/eyes/shadow name = "burning red eyes" desc = "Even without their shadowy owner, looking at these eyes gives you a sense of dread." icon = 'icons/obj/medical/organs/shadow_organs.dmi' + color_cutoffs = list(20, 10, 40) pepperspray_protect = TRUE diff --git a/code/modules/mob/living/carbon/human/species_types/zombies.dm b/code/modules/mob/living/carbon/human/species_types/zombies.dm index 6ea3c8c2d30..03f62813ed4 100644 --- a/code/modules/mob/living/carbon/human/species_types/zombies.dm +++ b/code/modules/mob/living/carbon/human/species_types/zombies.dm @@ -91,7 +91,7 @@ examine_limb_id = SPECIES_ZOMBIE armor = 20 // 120 damage to KO a zombie, which kills it speedmod = 1.6 - mutanteyes = /obj/item/organ/internal/eyes/night_vision/zombie + mutanteyes = /obj/item/organ/internal/eyes/zombie mutantbrain = /obj/item/organ/internal/brain/zombie changesource_flags = MIRROR_BADMIN | WABBAJACK | ERT_SPAWN /// The rate the zombies regenerate at diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 6715cf62393..4490bf2d285 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1825,8 +1825,8 @@ GLOBAL_LIST_EMPTY(fire_appearances) updatehealth() if(NAMEOF(src, resize)) update_transform() - if(NAMEOF(src, lighting_alpha)) - sync_lighting_plane_alpha() + if(NAMEOF(src, lighting_cutoff)) + sync_lighting_plane_cutoff() /mob/living/vv_get_header() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index a3077c6e577..67f652090f1 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -1,6 +1,5 @@ /mob/living see_invisible = SEE_INVISIBLE_LIVING - see_in_dark = 2 hud_possible = list(HEALTH_HUD,STATUS_HUD,ANTAG_HUD) pressure_resistance = 10 diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index c1ec5de9261..aa30f179e67 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -22,7 +22,6 @@ status_flags = CANSTUN|CANPUSH combat_mode = TRUE //so we always get pushed instead of trying to swap sight = SEE_TURFS | SEE_MOBS | SEE_OBJS - see_in_dark = NIGHTVISION_FOV_RANGE hud_type = /datum/hud/ai med_hud = DATA_HUD_MEDICAL_BASIC sec_hud = DATA_HUD_SECURITY_BASIC diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index bd99a6cec42..4f3b6d3feeb 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -80,11 +80,9 @@ /mob/living/silicon/ai/update_sight() set_invis_see(initial(see_invisible)) - set_see_in_dark(initial(see_in_dark)) set_sight(initial(sight)) if(aiRestorePowerRoutine) clear_sight(SEE_TURFS|SEE_MOBS|SEE_OBJS) - set_see_in_dark(0) if(see_override) set_invis_see(see_override) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index c1ad3573ebd..d403ce3c9bf 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -636,14 +636,13 @@ set_sight(initial(sight)) else set_sight(SEE_TURFS|SEE_MOBS|SEE_OBJS) - set_see_in_dark(8) set_invis_see(SEE_INVISIBLE_OBSERVER) return set_invis_see(initial(see_invisible)) - set_see_in_dark(initial(see_in_dark)) var/new_sight = initial(sight) - lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE + lighting_cutoff = LIGHTING_CUTOFF_VISIBLE + lighting_color_cutoffs = list(lighting_cutoff_red, lighting_cutoff_green, lighting_cutoff_blue) if(client.eye != src) var/atom/A = client.eye @@ -652,24 +651,20 @@ if(sight_mode & BORGMESON) new_sight |= SEE_TURFS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - set_see_in_dark(1) + lighting_color_cutoffs = blend_cutoff_colors(lighting_color_cutoffs, list(5, 15, 5)) if(sight_mode & BORGMATERIAL) new_sight |= SEE_OBJS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - set_see_in_dark(1) + lighting_color_cutoffs = blend_cutoff_colors(lighting_color_cutoffs, list(20, 25, 40)) if(sight_mode & BORGXRAY) new_sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS set_invis_see(SEE_INVISIBLE_LIVING) - set_see_in_dark(8) if(sight_mode & BORGTHERM) new_sight |= SEE_MOBS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + lighting_color_cutoffs = blend_cutoff_colors(lighting_color_cutoffs, list(25, 8, 5)) set_invis_see(min(see_invisible, SEE_INVISIBLE_LIVING)) - set_see_in_dark(8) if(see_override) set_invis_see(see_override) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 4b28a783db7..7844f8c31da 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -6,7 +6,6 @@ verb_exclaim = "declares" verb_yell = "alarms" initial_language_holder = /datum/language_holder/synthetic - see_in_dark = NIGHTVISION_FOV_RANGE bubble_icon = "machine" mob_biotypes = MOB_ROBOTIC death_sound = 'sound/voice/borg_deathsound.ogg' diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 398cf2f239f..d7029fdf766 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -12,7 +12,6 @@ emote_see = list("shakes their head.", "shivers.") speak_chance = 1 turns_per_move = 5 - see_in_dark = 6 pass_flags = PASSTABLE mob_size = MOB_SIZE_SMALL mob_biotypes = MOB_ORGANIC|MOB_BEAST diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index cf122e92039..405864522c0 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -46,8 +46,11 @@ faction = list(FACTION_NEUTRAL,"silicon","turret") dextrous = TRUE dextrous_hud_type = /datum/hud/dextrous/drone - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - see_in_dark = 7 + // Going for a sort of pale green here + lighting_cutoff_red = 30 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 25 + can_be_held = TRUE worn_slot_flags = ITEM_SLOT_HEAD held_items = list(null, null) diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index feff181d6ca..6d1267a8b75 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -11,7 +11,6 @@ emote_see = list("shakes their head.", "stamps a foot.", "glares around.") speak_chance = 1 turns_per_move = 5 - see_in_dark = 6 butcher_results = list(/obj/item/food/meat/slab = 4) response_help_continuous = "pets" response_help_simple = "pet" @@ -266,7 +265,6 @@ GLOBAL_VAR_INIT(chicken_count, 0) emote_see = list("shakes her head.") speak_chance = 1 turns_per_move = 5 - see_in_dark = 6 butcher_results = list(/obj/item/food/meat/slab = 3) response_help_continuous = "pets" response_help_simple = "pet" diff --git a/code/modules/mob/living/simple_animal/friendly/fox.dm b/code/modules/mob/living/simple_animal/friendly/fox.dm index a2dc6d0cd59..00a51c5f83f 100644 --- a/code/modules/mob/living/simple_animal/friendly/fox.dm +++ b/code/modules/mob/living/simple_animal/friendly/fox.dm @@ -12,7 +12,6 @@ emote_see = list("shakes their head.", "shivers.") speak_chance = 1 turns_per_move = 5 - see_in_dark = 6 butcher_results = list(/obj/item/food/meat/slab = 3) response_help_continuous = "pets" response_help_simple = "pet" diff --git a/code/modules/mob/living/simple_animal/friendly/penguin.dm b/code/modules/mob/living/simple_animal/friendly/penguin.dm index 4480f324052..a4a71ee49fc 100644 --- a/code/modules/mob/living/simple_animal/friendly/penguin.dm +++ b/code/modules/mob/living/simple_animal/friendly/penguin.dm @@ -14,7 +14,6 @@ emote_see = list("shakes his beak.", "flaps his wings.","preens himself.") faction = list("penguin") minbodytemp = 0 - see_in_dark = 5 speak_chance = 1 turns_per_move = 10 icon = 'icons/mob/simple/penguins.dmi' diff --git a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm index c46a926a528..0cb7303e26a 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm @@ -27,7 +27,6 @@ creator_desc = "Has two modes. Ranged; which fires a constant stream of weak, armor-ignoring projectiles. Scout; where it cannot attack, but can move through walls and is quite hard to see. Can lay surveillance snares, which alert it when crossed, in either mode." creator_icon = "ranged" see_invisible = SEE_INVISIBLE_LIVING - see_in_dark = NIGHTVISION_FOV_RANGE toggle_button_type = /atom/movable/screen/guardian/toggle_mode /// List of all deployed snares. var/list/snares = list() @@ -79,20 +78,28 @@ /mob/living/simple_animal/hostile/guardian/ranged/toggle_light() var/msg - switch(lighting_alpha) - if (LIGHTING_PLANE_ALPHA_VISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + switch(lighting_cutoff) + if (LIGHTING_CUTOFF_VISIBLE) + lighting_cutoff_red = 10 + lighting_cutoff_green = 10 + lighting_cutoff_blue = 15 msg = "You activate your night vision." - if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + if (LIGHTING_CUTOFF_MEDIUM) + lighting_cutoff_red = 25 + lighting_cutoff_green = 25 + lighting_cutoff_blue = 35 msg = "You increase your night vision." - if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + if (LIGHTING_CUTOFF_HIGH) + lighting_cutoff_red = 35 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 50 msg = "You maximize your night vision." else - lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE + lighting_cutoff_red = 0 + lighting_cutoff_green = 0 + lighting_cutoff_blue = 0 msg = "You deactivate your night vision." - sync_lighting_plane_alpha() + sync_lighting_plane_cutoff() to_chat(src, span_notice(msg)) diff --git a/code/modules/mob/living/simple_animal/hostile/alien.dm b/code/modules/mob/living/simple_animal/hostile/alien.dm index 62f1244e1f3..b392417aab2 100644 --- a/code/modules/mob/living/simple_animal/hostile/alien.dm +++ b/code/modules/mob/living/simple_animal/hostile/alien.dm @@ -28,8 +28,10 @@ status_flags = CANPUSH minbodytemp = 0 unsuitable_heat_damage = 20 - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Going for a dark purple here + lighting_cutoff_red = 30 + lighting_cutoff_green = 15 + lighting_cutoff_blue = 50 unique_name = 1 gold_core_spawnable = NO_SPAWN death_sound = 'sound/voice/hiss6.ogg' diff --git a/code/modules/mob/living/simple_animal/hostile/ant.dm b/code/modules/mob/living/simple_animal/hostile/ant.dm index 72c29842bec..2e5ca376264 100644 --- a/code/modules/mob/living/simple_animal/hostile/ant.dm +++ b/code/modules/mob/living/simple_animal/hostile/ant.dm @@ -11,7 +11,6 @@ emote_see = list("shakes their head.", "twitches their antennae.") speak_chance = 1 turns_per_move = 5 - see_in_dark = 6 gender = PLURAL // We are Ven-ant pass_flags = PASSTABLE mob_size = MOB_SIZE_SMALL diff --git a/code/modules/mob/living/simple_animal/hostile/bear.dm b/code/modules/mob/living/simple_animal/hostile/bear.dm index 08797c90205..b7591609d7b 100644 --- a/code/modules/mob/living/simple_animal/hostile/bear.dm +++ b/code/modules/mob/living/simple_animal/hostile/bear.dm @@ -14,7 +14,6 @@ speak_chance = 1 taunt_chance = 25 turns_per_move = 5 - see_in_dark = 6 butcher_results = list(/obj/item/food/meat/slab/bear = 5, /obj/item/clothing/head/costume/bearpelt = 1) response_help_continuous = "pets" response_help_simple = "pet" diff --git a/code/modules/mob/living/simple_animal/hostile/blob.dm b/code/modules/mob/living/simple_animal/hostile/blob.dm index eb352e16a3f..88a2d21fa04 100644 --- a/code/modules/mob/living/simple_animal/hostile/blob.dm +++ b/code/modules/mob/living/simple_animal/hostile/blob.dm @@ -10,8 +10,10 @@ maxbodytemp = INFINITY unique_name = 1 combat_mode = TRUE - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // ... Blob colored lighting + lighting_cutoff_red = 20 + lighting_cutoff_green = 40 + lighting_cutoff_blue = 30 initial_language_holder = /datum/language_holder/empty retreat_distance = null //! retreat doesn't obey pass_flags, so won't work on blob mobs. /// Blob camera that controls the blob diff --git a/code/modules/mob/living/simple_animal/hostile/constructs/constructs.dm b/code/modules/mob/living/simple_animal/hostile/constructs/constructs.dm index bb4ae37efbb..eb404e9c921 100644 --- a/code/modules/mob/living/simple_animal/hostile/constructs/constructs.dm +++ b/code/modules/mob/living/simple_animal/hostile/constructs/constructs.dm @@ -18,8 +18,10 @@ stop_automated_movement = 1 status_flags = CANPUSH attack_sound = 'sound/weapons/punch1.ogg' - see_in_dark = 7 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Vivid red, cause cult theme + lighting_cutoff_red = 30 + lighting_cutoff_green = 5 + lighting_cutoff_blue = 20 damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 diff --git a/code/modules/mob/living/simple_animal/hostile/eyeballs.dm b/code/modules/mob/living/simple_animal/hostile/eyeballs.dm index bc84e60936c..39cd4692c9e 100644 --- a/code/modules/mob/living/simple_animal/hostile/eyeballs.dm +++ b/code/modules/mob/living/simple_animal/hostile/eyeballs.dm @@ -31,7 +31,10 @@ gold_core_spawnable = HOSTILE_SPAWN faction = list("spooky") del_on_death = 1 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Redish ethereal glow. These lads live on the cult ship + lighting_cutoff_red = 40 + lighting_cutoff_green = 20 + lighting_cutoff_blue = 30 sight = SEE_SELF|SEE_MOBS|SEE_OBJS|SEE_TURFS /mob/living/simple_animal/hostile/eyeball/Initialize(mapload) diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 5512880978d..9aa78a226c6 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -44,8 +44,10 @@ attack_vis_effect = ATTACK_EFFECT_BITE unique_name = 1 gold_core_spawnable = HOSTILE_SPAWN - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - see_in_dark = NIGHTVISION_FOV_RANGE + // VERY red, to fit the eyes + lighting_cutoff_red = 22 + lighting_cutoff_green = 5 + lighting_cutoff_blue = 5 footstep_type = FOOTSTEP_MOB_CLAW ///How much of a reagent the mob injects on attack var/poison_per_bite = 0 diff --git a/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm b/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm index 7e2ab739b36..962afa822b6 100644 --- a/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm +++ b/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm @@ -18,8 +18,10 @@ combat_mode = TRUE stop_automated_movement = TRUE AIStatus = AI_OFF - see_in_dark = 7 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Sort of greenish brown, to match the vibeTM + lighting_cutoff_red = 20 + lighting_cutoff_green = 25 + lighting_cutoff_blue = 5 damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/_jungle_mobs.dm b/code/modules/mob/living/simple_animal/hostile/jungle/_jungle_mobs.dm index 1d62fd3128f..db72dafb657 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/_jungle_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/_jungle_mobs.dm @@ -10,6 +10,8 @@ response_harm_simple = "strike" status_flags = NONE combat_mode = TRUE - see_in_dark = 4 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Let's do a blue, since they'll be on green turfs if this shit is ever finished + lighting_cutoff_red = 5 + lighting_cutoff_green = 20 + lighting_cutoff_blue = 25 mob_size = MOB_SIZE_LARGE diff --git a/code/modules/mob/living/simple_animal/hostile/killertomato.dm b/code/modules/mob/living/simple_animal/hostile/killertomato.dm index 91571a34991..c9fca860f51 100644 --- a/code/modules/mob/living/simple_animal/hostile/killertomato.dm +++ b/code/modules/mob/living/simple_animal/hostile/killertomato.dm @@ -10,7 +10,6 @@ turns_per_move = 5 maxHealth = 30 health = 30 - see_in_dark = 3 butcher_results = list(/obj/item/food/meat/slab/killertomato = 2) response_help_continuous = "prods" response_help_simple = "prod" diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm index d49bcad990c..9b0ac5be63a 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/hivelord.dm @@ -274,8 +274,10 @@ weather_immunities = list(TRAIT_LAVA_IMMUNE, TRAIT_ASHSTORM_IMMUNE) obj_damage = 30 environment_smash = ENVIRONMENT_SMASH_STRUCTURES - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Purple, but bright cause we're gonna need to spot mobs on lavaland + lighting_cutoff_red = 35 + lighting_cutoff_green = 20 + lighting_cutoff_blue = 45 /mob/living/simple_animal/hostile/big_legion/Initialize(mapload) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm index d23cf444676..c72bc827e14 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm @@ -15,8 +15,10 @@ combat_mode = TRUE var/throw_message = "bounces off of" var/fromtendril = FALSE - see_in_dark = 8 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Pale purple, should be red enough to see stuff on lavaland + lighting_cutoff_red = 25 + lighting_cutoff_green = 15 + lighting_cutoff_blue = 35 mob_size = MOB_SIZE_LARGE var/icon_aggro = null diff --git a/code/modules/mob/living/simple_animal/hostile/morph.dm b/code/modules/mob/living/simple_animal/hostile/morph.dm index e4981489622..da01eabb34a 100644 --- a/code/modules/mob/living/simple_animal/hostile/morph.dm +++ b/code/modules/mob/living/simple_animal/hostile/morph.dm @@ -20,8 +20,10 @@ obj_damage = 50 melee_damage_lower = 20 melee_damage_upper = 20 - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Oh you KNOW it's gonna be real green + lighting_cutoff_red = 10 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 15 vision_range = 1 // Only attack when target is close wander = FALSE attack_verb_continuous = "glomps" diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index bd94d7508ba..c69c15f63e0 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -8,8 +8,11 @@ turns_per_move = 5 maxHealth = 70 health = 70 - see_in_dark = 15 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + // Slightly brown red, for the eyes + // Might be a bit too dim + lighting_cutoff_red = 22 + lighting_cutoff_green = 8 + lighting_cutoff_blue = 5 obj_damage = 10 butcher_results = list(/obj/item/food/meat/slab/mouse = 2, /obj/item/clothing/head/costume/crown = 1) response_help_continuous = "glares at" diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm index 4d1dac06918..7b8ac961a35 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm @@ -14,7 +14,6 @@ speak_chance = 0 maxHealth = 15 health = 15 - see_in_dark = 10 harm_intent_damage = 6 melee_damage_lower = 5 melee_damage_upper = 6 diff --git a/code/modules/mob/living/simple_animal/hostile/skeleton.dm b/code/modules/mob/living/simple_animal/hostile/skeleton.dm index a03c695ce54..1e7b69e77f5 100644 --- a/code/modules/mob/living/simple_animal/hostile/skeleton.dm +++ b/code/modules/mob/living/simple_animal/hostile/skeleton.dm @@ -26,8 +26,10 @@ robust_searching = 1 stat_attack = HARD_CRIT faction = list("skeleton") - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Going for a sort of pale bluegreen here, shooting for boneish + lighting_cutoff_red = 15 + lighting_cutoff_green = 25 + lighting_cutoff_blue = 35 footstep_type = FOOTSTEP_MOB_SHOE death_message = "collapses into a pile of bones!" del_on_death = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/slaughter_demon.dm b/code/modules/mob/living/simple_animal/hostile/slaughter_demon.dm index 132a7860cf1..6d4a1d6090c 100644 --- a/code/modules/mob/living/simple_animal/hostile/slaughter_demon.dm +++ b/code/modules/mob/living/simple_animal/hostile/slaughter_demon.dm @@ -35,8 +35,10 @@ obj_damage = 40 melee_damage_lower = 10 melee_damage_upper = 15 - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // You KNOW we're doing a lightly purple red + lighting_cutoff_red = 30 + lighting_cutoff_green = 10 + lighting_cutoff_blue = 20 del_on_death = TRUE death_message = "screams in agony as it sublimates into a sulfurous smoke." death_sound = 'sound/magic/demon_dies.ogg' diff --git a/code/modules/mob/living/simple_animal/hostile/smspider.dm b/code/modules/mob/living/simple_animal/hostile/smspider.dm index 30e8362e985..0d3fe71e645 100644 --- a/code/modules/mob/living/simple_animal/hostile/smspider.dm +++ b/code/modules/mob/living/simple_animal/hostile/smspider.dm @@ -25,8 +25,10 @@ atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) robust_searching = 1 faction = list("hostile") - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Gold, supermatter tinted + lighting_cutoff_red = 30 + lighting_cutoff_green = 30 + lighting_cutoff_blue = 10 death_message = "falls to the ground, its shard dulling to a miserable grey!" footstep_type = FOOTSTEP_MOB_CLAW var/overcharged = FALSE // if true, spider will not die if it dusts a limb diff --git a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm index 650443c79d7..4df4b7bcd75 100644 --- a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm +++ b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm @@ -18,7 +18,10 @@ melee_damage_lower = 25 melee_damage_upper = 25 obj_damage = 40 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Greenish, seems about right for it + lighting_cutoff_red = 10 + lighting_cutoff_green = 25 + lighting_cutoff_blue = 20 attack_sound = 'sound/weapons/punch3.ogg' attack_verb_continuous = "slaps" attack_verb_simple = "slap" diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index 740416547d1..7e98303db8f 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -156,7 +156,10 @@ unsuitable_atmos_damage = 0 /// copied over from the code from eyeballs (the mob) to make it easier for venus human traps to see in kudzu that doesn't have the transparency mutation sight = SEE_SELF|SEE_MOBS|SEE_OBJS|SEE_TURFS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Real green, cause of course + lighting_cutoff_red = 10 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 20 faction = list("hostile","vines","plants") initial_language_holder = /datum/language_holder/venus unique_name = TRUE diff --git a/code/modules/mob/living/simple_animal/revenant.dm b/code/modules/mob/living/simple_animal/revenant.dm index 3c0ccc491c2..8b10c4d94d9 100644 --- a/code/modules/mob/living/simple_animal/revenant.dm +++ b/code/modules/mob/living/simple_animal/revenant.dm @@ -23,8 +23,10 @@ sight = SEE_SELF throwforce = 0 - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + // Going for faint purple spoopy ghost + lighting_cutoff_red = 20 + lighting_cutoff_green = 15 + lighting_cutoff_blue = 35 response_help_continuous = "passes through" response_help_simple = "pass through" response_disarm_continuous = "swings through" @@ -74,8 +76,6 @@ ADD_TRAIT(src, TRAIT_FREE_HYPERSPACE_MOVEMENT, INNATE_TRAIT) // Starting spells - var/datum/action/cooldown/spell/night_vision/revenant/vision = new(src) - vision.Grant(src) var/datum/action/cooldown/spell/list_target/telepathy/revenant/telepathy = new(src) telepathy.Grant(src) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 54688eba617..189c15aa617 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -577,12 +577,11 @@ set_sight(initial(sight)) else set_sight(SEE_TURFS|SEE_MOBS|SEE_OBJS) - set_see_in_dark(NIGHTVISION_FOV_RANGE) set_invis_see(SEE_INVISIBLE_OBSERVER) return + lighting_color_cutoffs = list(lighting_cutoff_red, lighting_cutoff_green, lighting_cutoff_blue) set_invis_see(initial(see_invisible)) - set_see_in_dark(initial(see_in_dark)) if(SSmapping.level_trait(z, ZTRAIT_NOXRAY)) set_sight(null) else diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index dbe3641dd28..88d790b1d49 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -30,7 +30,6 @@ healable = 0 melee_damage_lower = 5 melee_damage_upper = 25 - see_in_dark = NIGHTVISION_FOV_RANGE verb_say = "blorbles" verb_ask = "inquisitively blorbles" diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 9c64a3fa893..de30a49420e 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -282,7 +282,7 @@ if(M != loc) // Only give the blind message to hearers that aren't the location msg = blind_message msg_type = MSG_AUDIBLE - else if(!HAS_TRAIT(M, TRAIT_HEAR_THROUGH_DARKNESS) && M.lighting_alpha > LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE && T.is_softly_lit() && !in_range(T,M)) //if it is too dark, unless we're right next to them. + else if(!HAS_TRAIT(M, TRAIT_HEAR_THROUGH_DARKNESS) && M.lighting_cutoff < LIGHTING_CUTOFF_HIGH && T.is_softly_lit() && !in_range(T,M)) //if it is too dark, unless we're right next to them. msg = blind_message msg_type = MSG_AUDIBLE if(!msg) @@ -545,7 +545,13 @@ // shift-click catcher may issue examinate() calls for out-of-sight turfs return - if(is_blind() && !blind_examine_check(examinify)) //blind people see things differently (through touch) + var/turf/examine_turf = get_turf(examinify) + if(is_blind()) //blind people see things differently (through touch) + if(!blind_examine_check(examinify)) + return + else if(!examine_turf.luminosity && \ + get_dist(src, examine_turf) > 1 && \ + !has_nightvision()) // If you aren't blind, it's in darkness (that you can't see) and farther then next to you return face_atom(examinify) @@ -1158,14 +1164,14 @@ /mob/proc/update_sight() SHOULD_CALL_PARENT(TRUE) SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) - sync_lighting_plane_alpha() + sync_lighting_plane_cutoff() -///Set the lighting plane hud alpha to the mobs lighting_alpha var -/mob/proc/sync_lighting_plane_alpha() +///Set the lighting plane hud filters to the mobs lighting_cutoff var +/mob/proc/sync_lighting_plane_cutoff() if(!hud_used) return - for(var/atom/movable/screen/plane_master/light_plane as anything in hud_used.get_true_plane_masters(RENDER_PLANE_LIGHTING)) - light_plane.set_alpha(lighting_alpha) + for(var/atom/movable/screen/plane_master/rendering_plate/lighting/light as anything in hud_used.get_true_plane_masters(RENDER_PLANE_LIGHTING)) + light.set_light_cutoff(lighting_cutoff, lighting_color_cutoffs) ///Update the mouse pointer of the attached client in this mob /mob/proc/update_mouse_pointer() @@ -1186,10 +1192,12 @@ * Can this mob see in the dark * * This checks all traits, glasses, and robotic eyeball implants to see if the mob can see in the dark - * this does NOT check if the mob is missing it's eyeballs. Also see_in_dark is a BYOND mob var (that defaults to 2) + * this does NOT check if the mob is missing it's eyeballs. **/ /mob/proc/has_nightvision() - return see_in_dark >= NIGHTVISION_FOV_RANGE + // Somewhat conservative, basically is your lighting plane bright enough that you the user can see stuff + var/light_offset = (lighting_color_cutoffs[1] + lighting_color_cutoffs[2] + lighting_color_cutoffs[3]) / 3 + lighting_cutoff + return light_offset >= LIGHTING_NIGHTVISION_THRESHOLD /// This mob is abile to read books /mob/proc/is_literate() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index d6434d82ad2..035571fb0b5 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -17,6 +17,9 @@ throwforce = 10 blocks_emissive = EMISSIVE_BLOCK_GENERIC pass_flags_self = PASSMOB + // we never want to hide a turf because it's not lit + // We can rely on the lighting plane to handle that for us + see_in_dark = 1e6 /// The current client inhabiting this mob. Managed by login/logout /// This exists so we can do cleanup in logout for occasions where a client was transfere rather then destroyed /// We need to do this because the mob on logout never actually has a reference to client @@ -26,7 +29,19 @@ var/shift_to_open_context_menu = TRUE - var/lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE + /// Percentage of how much rgb to max the lighting plane at + /// This lets us brighten it without washing out color + /// Scale from 0-100, reset off update_sight() + var/lighting_cutoff = LIGHTING_CUTOFF_VISIBLE + // Individual color max for red, we can use this to color darkness without tinting the light + var/lighting_cutoff_red = 0 + // Individual color max for green, we can use this to color darkness without tinting the light + var/lighting_cutoff_green = 0 + // Individual color max for blue, we can use this to color darkness without tinting the light + var/lighting_cutoff_blue = 0 + /// A list of red, green and blue cutoffs + /// This is what actually gets applied to the mob, it's modified by things like glasses + var/list/lighting_color_cutoffs = null var/datum/mind/mind var/static/next_mob_id = 0 diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 32e9b883be3..dac8f35e0b5 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -414,10 +414,10 @@ return length(held_items) /// Returns this mob's default lighting alpha -/mob/proc/default_lighting_alpha() +/mob/proc/default_lighting_cutoff() if(client?.combo_hud_enabled && client?.prefs?.toggles & COMBOHUD_LIGHTING) - return LIGHTING_PLANE_ALPHA_INVISIBLE - return initial(lighting_alpha) + return LIGHTING_CUTOFF_FULLBRIGHT + return initial(lighting_cutoff) /// Returns a generic path of the object based on the slot /proc/get_path_by_slot(slot_id) diff --git a/code/modules/mob/status_procs.dm b/code/modules/mob/status_procs.dm index ebfceaf2971..1dde25c7802 100644 --- a/code/modules/mob/status_procs.dm +++ b/code/modules/mob/status_procs.dm @@ -40,16 +40,3 @@ var/old_invis = see_invisible see_invisible = new_sight SEND_SIGNAL(src, COMSIG_MOB_SEE_INVIS_CHANGE, see_invisible, old_invis) - -/// see_in_dark is essentially just a range value -/// Basically, if a tile has 0 luminosity affecting it, it will be counted as "dark" -/// Then, if said tile is farther then see_in_dark from your mob, it will, rather then being rendered -/// As a normal tile with contents, instead be covered by "darkness". This effectively means it gets masked away, we don't even try to draw it. -/// You can see this effect by going somewhere dark, and cranking the alpha on the lighting plane to 0 -/mob/proc/set_see_in_dark(new_dark) - SHOULD_CALL_PARENT(TRUE) - if(new_dark == see_in_dark) - return - var/old_dark = see_in_dark - see_in_dark = new_dark - SEND_SIGNAL(src, COMSIG_MOB_SEE_IN_DARK_CHANGE, see_in_dark, old_dark) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index a8db731c1e6..b6e70a7dbaa 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -646,17 +646,12 @@ improve_eyesight(affected_mob, eyes) /datum/reagent/medicine/oculine/proc/improve_eyesight(mob/living/carbon/affected_mob, obj/item/organ/internal/eyes/eyes) - delta_light = creation_purity*30 - if(eyes.lighting_alpha) - eyes.lighting_alpha -= delta_light - else - eyes.lighting_alpha = 255 - delta_light - eyes.see_in_dark += 3 + delta_light = creation_purity*10 + eyes.lighting_cutoff += delta_light affected_mob.update_sight() /datum/reagent/medicine/oculine/proc/restore_eyesight(mob/living/carbon/affected_mob, obj/item/organ/internal/eyes/eyes) - eyes.lighting_alpha += delta_light - eyes.see_in_dark -= 3 + eyes.lighting_cutoff -= delta_light affected_mob.update_sight() /datum/reagent/medicine/oculine/proc/on_gained_organ(mob/affected_mob, obj/item/organ/organ) diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index b4f82b01f8c..bc1164f56b2 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -320,8 +320,9 @@ /mob/camera/ai_eye/remote/shuttle_docker/update_remote_sight(mob/living/user) user.set_sight(BLIND|SEE_TURFS) - user.lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE - user.sync_lighting_plane_alpha() + // Pale blue, should look nice I think + user.lighting_color_cutoffs = list(30, 40, 50) + user.sync_lighting_plane_cutoff() return TRUE /datum/action/innate/shuttledocker_rotate diff --git a/code/modules/spells/spell_types/self/night_vision.dm b/code/modules/spells/spell_types/self/night_vision.dm deleted file mode 100644 index e7211aeb7a2..00000000000 --- a/code/modules/spells/spell_types/self/night_vision.dm +++ /dev/null @@ -1,40 +0,0 @@ - -//Toggle Night Vision -/datum/action/cooldown/spell/night_vision - name = "Toggle Nightvision" - desc = "Toggle your nightvision mode." - - cooldown_time = 1 SECONDS - spell_requirements = NONE - - /// The span the "toggle" message uses when sent to the user - var/toggle_span = "notice" - -/datum/action/cooldown/spell/night_vision/New(Target) - . = ..() - name = "[name] \[ON\]" - -/datum/action/cooldown/spell/night_vision/is_valid_target(atom/cast_on) - return isliving(cast_on) - -/datum/action/cooldown/spell/night_vision/cast(mob/living/cast_on) - . = ..() - to_chat(cast_on, "You toggle your night vision.") - - var/next_mode_text = "" - switch(cast_on.lighting_alpha) - if (LIGHTING_PLANE_ALPHA_VISIBLE) - cast_on.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - next_mode_text = "More" - if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) - cast_on.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - next_mode_text = "Full" - if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) - cast_on.lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE - next_mode_text = "OFF" - else - cast_on.lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE - next_mode_text = "ON" - - cast_on.update_sight() - name = "[initial(name)] \[[next_mode_text]\]" diff --git a/code/modules/surgery/organs/eyes.dm b/code/modules/surgery/organs/eyes.dm index 2646c75f92a..db53ce8412b 100644 --- a/code/modules/surgery/organs/eyes.dm +++ b/code/modules/surgery/organs/eyes.dm @@ -24,18 +24,18 @@ var/sight_flags = NONE /// changes how the eyes overlay is applied, makes it apply over the lighting layer var/overlay_ignore_lighting = FALSE - /// How much a mob can see in the dark with these eyes - var/see_in_dark = 2 /// How much innate tint these eyes have var/tint = 0 /// How much innare flash protection these eyes have, usually paired with tint var/flash_protect = FLASH_PROTECTION_NONE /// What level of invisibility these eyes can see var/see_invisible = SEE_INVISIBLE_LIVING + /// How much darkness to cut out of your view (basically, night vision) + var/lighting_cutoff = null + /// List of color cutoffs from eyes, or null if not applicable + var/list/color_cutoffs = null /// Are these eyes immune to pepperspray? var/pepperspray_protect = FALSE - /// How much alpha lighting has (basically, night vision) - var/lighting_alpha var/eye_color_left = "" //set to a hex code to override a mob's left eye color var/eye_color_right = "" //set to a hex code to override a mob's right eye color @@ -76,8 +76,8 @@ affected_human.eye_color_right = eye_color_right else eye_color_right = affected_human.eye_color_right - if(HAS_TRAIT(affected_human, TRAIT_NIGHT_VISION) && !lighting_alpha) - lighting_alpha = LIGHTING_PLANE_ALPHA_NV_TRAIT + if(HAS_TRAIT(affected_human, TRAIT_NIGHT_VISION) && !lighting_cutoff) + lighting_cutoff = LIGHTING_CUTOFF_REAL_LOW if(CONFIG_GET(flag/native_fov) && native_fov) owner.add_fov_trait(type, native_fov) @@ -200,37 +200,69 @@ damaged = TRUE +#define NIGHTVISION_LIGHT_OFF 0 +#define NIGHTVISION_LIGHT_LOW 1 +#define NIGHTVISION_LIGHT_MID 2 +#define NIGHTVISION_LIGHT_HIG 3 + /obj/item/organ/internal/eyes/night_vision - see_in_dark = NIGHTVISION_FOV_RANGE - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE actions_types = list(/datum/action/item_action/organ_action/use) - var/night_vision = TRUE + + // These lists are used as the color cutoff for the eye + // They need to be filled out for subtypes + var/list/low_light_cutoff + var/list/medium_light_cutoff + var/list/high_light_cutoff + var/light_level = NIGHTVISION_LIGHT_OFF + +/obj/item/organ/internal/eyes/night_vision/Initialize(mapload) + . = ..() + if (PERFORM_ALL_TESTS(focus_only/nightvision_color_cutoffs) && type != /obj/item/organ/internal/eyes/night_vision) + if(length(low_light_cutoff) != 3 || length(medium_light_cutoff) != 3 || length(high_light_cutoff) != 3) + stack_trace("[type] did not have fully filled out color cutoff lists") + if(low_light_cutoff) + color_cutoffs = low_light_cutoff.Copy() + light_level = NIGHTVISION_LIGHT_LOW /obj/item/organ/internal/eyes/night_vision/ui_action_click() sight_flags = initial(sight_flags) - switch(lighting_alpha) - if (LIGHTING_PLANE_ALPHA_VISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - if (LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - if (LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE) - lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + switch(light_level) + if (NIGHTVISION_LIGHT_OFF) + color_cutoffs = low_light_cutoff.Copy() + light_level = NIGHTVISION_LIGHT_LOW + if (NIGHTVISION_LIGHT_LOW) + color_cutoffs = medium_light_cutoff.Copy() + light_level = NIGHTVISION_LIGHT_MID + if (NIGHTVISION_LIGHT_MID) + color_cutoffs = high_light_cutoff.Copy() + light_level = NIGHTVISION_LIGHT_HIG else - lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE + color_cutoffs = list() + light_level = NIGHTVISION_LIGHT_OFF owner.update_sight() -/obj/item/organ/internal/eyes/night_vision/alien - name = "alien eyes" - desc = "It turned out they had them after all!" - sight_flags = SEE_MOBS - -/obj/item/organ/internal/eyes/night_vision/zombie - name = "undead eyes" - desc = "Somewhat counterintuitively, these half-rotten eyes actually have superior vision to those of a living human." +#undef NIGHTVISION_LIGHT_OFF +#undef NIGHTVISION_LIGHT_LOW +#undef NIGHTVISION_LIGHT_MID +#undef NIGHTVISION_LIGHT_HIG /obj/item/organ/internal/eyes/night_vision/mushroom name = "fung-eye" desc = "While on the outside they look inert and dead, the eyes of mushroom people are actually very advanced." + low_light_cutoff = list(0, 15, 20) + medium_light_cutoff = list(0, 20, 35) + high_light_cutoff = list(0, 40, 50) + +/obj/item/organ/internal/eyes/zombie + name = "undead eyes" + desc = "Somewhat counterintuitively, these half-rotten eyes actually have superior vision to those of a living human." + color_cutoffs = list(25, 35, 5) + +/obj/item/organ/internal/eyes/alien + name = "alien eyes" + desc = "It turned out they had them after all!" + sight_flags = SEE_MOBS + color_cutoffs = list(25, 5, 42) ///Robotic @@ -272,7 +304,6 @@ desc = "These cybernetic eyes will give you X-ray vision. Blinking is futile." eye_color_left = "000" eye_color_right = "000" - see_in_dark = NIGHTVISION_FOV_RANGE sight_flags = SEE_MOBS | SEE_OBJS | SEE_TURFS /obj/item/organ/internal/eyes/robotic/xray/Insert(mob/living/carbon/eye_owner, special = FALSE, drop_if_replaced = TRUE) @@ -288,10 +319,10 @@ desc = "These cybernetic eye implants will give you thermal vision. Vertical slit pupil included." eye_color_left = "FC0" eye_color_right = "FC0" + // We're gonna downshift green and blue a bit so darkness looks yellow + color_cutoffs = list(25, 8, 5) sight_flags = SEE_MOBS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE flash_protect = FLASH_PROTECTION_SENSITIVE - see_in_dark = NIGHTVISION_FOV_RANGE /obj/item/organ/internal/eyes/robotic/flashlight name = "flashlight eyes" @@ -568,6 +599,9 @@ icon_state = "adapted_eyes" eye_icon_state = "eyes_glow" overlay_ignore_lighting = TRUE + low_light_cutoff = list(5, 12, 20) + medium_light_cutoff = list(15, 20, 30) + high_light_cutoff = list(30, 35, 50) var/obj/item/flashlight/eyelight/adapted/adapt_light /obj/item/organ/internal/eyes/night_vision/maintenance_adapted/Insert(mob/living/carbon/adapted, special = FALSE, drop_if_replaced = TRUE) diff --git a/code/modules/unit_tests/focus_only_tests.dm b/code/modules/unit_tests/focus_only_tests.dm index f1218814b95..53767514a37 100644 --- a/code/modules/unit_tests/focus_only_tests.dm +++ b/code/modules/unit_tests/focus_only_tests.dm @@ -24,5 +24,8 @@ /// Checks that floor tiles are properly mapped to broken/burnt /datum/unit_test/focus_only/valid_turf_states +/// Checks that nightvision eyes have a full set of color lists +/datum/unit_test/focus_only/nightvision_color_cutoffs + /// Checks that no light shares a tile/pixel offsets with another /datum/unit_test/focus_only/stacked_lights diff --git a/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/syndicatefox.dm b/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/syndicatefox.dm index c9c29ba1a85..e804bb3af5f 100644 --- a/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/syndicatefox.dm +++ b/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/syndicatefox.dm @@ -12,7 +12,6 @@ icon_living = "syndifox" icon_dead = "syndifox_dead" speak_emote = list("geckers", "barks") - see_in_dark = 6 can_be_held = FALSE butcher_results = list(/obj/item/food/meat/slab = 3) attack_verb_continuous = "bites" diff --git a/modular_skyrat/modules/awaymissions_skyrat/code/mothership_astrum.dm b/modular_skyrat/modules/awaymissions_skyrat/code/mothership_astrum.dm index bd1a09fc56f..af339f332e5 100644 --- a/modular_skyrat/modules/awaymissions_skyrat/code/mothership_astrum.dm +++ b/modular_skyrat/modules/awaymissions_skyrat/code/mothership_astrum.dm @@ -255,7 +255,7 @@ /obj/item/clothing/head/helmet/astrum = 10, /obj/item/organ/internal/cyberimp/arm/armblade = 5, /obj/effect/gibspawner/generic = 10, - /obj/item/organ/internal/eyes/night_vision/alien = 5 + /obj/item/organ/internal/eyes/alien = 5 ) /obj/item/gun/energy/alien/zeta diff --git a/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_mobs.dm b/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_mobs.dm index f8c9dcd56cf..e8a3ee2057f 100644 --- a/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_mobs.dm +++ b/modular_skyrat/modules/biohazard_blob/code/biohazard_blob_mobs.dm @@ -1,7 +1,8 @@ /mob/living/simple_animal/hostile/biohazard_blob gold_core_spawnable = HOSTILE_SPAWN - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - see_in_dark = 4 + lighting_cutoff_red = 0 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 20 mob_biotypes = MOB_ORGANIC gold_core_spawnable = NO_SPAWN icon = 'modular_skyrat/modules/biohazard_blob/icons/blob_mobs.dmi' diff --git a/modular_skyrat/modules/company_imports/code/objects/hud_glasses.dm b/modular_skyrat/modules/company_imports/code/objects/hud_glasses.dm index 91ec4aab391..241d5bcfca3 100644 --- a/modular_skyrat/modules/company_imports/code/objects/hud_glasses.dm +++ b/modular_skyrat/modules/company_imports/code/objects/hud_glasses.dm @@ -9,7 +9,6 @@ /obj/item/clothing/glasses/hud/gun_permit/sunglasses name = "permit HUD sunglasses" desc = "A pair of sunglasses with a heads-up display that scans humanoids in view, and displays if their current ID possesses a firearms permit or not." - darkness_view = 1 flash_protect = FLASH_PROTECTION_FLASH tint = 1 diff --git a/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm b/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm index ce1d59aeda3..7cd1b38c6be 100644 --- a/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm +++ b/modular_skyrat/modules/customization/modules/clothing/glasses/hud.dm @@ -60,9 +60,9 @@ icon_state = "mesonpatch" base_icon_state = "mesonpatch" clothing_traits = list(TRAIT_MADNESS_IMMUNE) - darkness_view = 2 vision_flags = SEE_TURFS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + color_cutoffs = list(5, 15, 5) + lighting_cutoff = LIGHTING_CUTOFF_MEDIUM glass_colour_type = /datum/client_colour/glass_colour/lightgreen unique_reskin = list( diff --git a/modular_skyrat/modules/exp_corps/code/clothing.dm b/modular_skyrat/modules/exp_corps/code/clothing.dm index f1a1b73bbf8..52ed35524bb 100644 --- a/modular_skyrat/modules/exp_corps/code/clothing.dm +++ b/modular_skyrat/modules/exp_corps/code/clothing.dm @@ -229,8 +229,7 @@ if(current_user) var/obj/item/organ/internal/eyes/my_eyes = current_user.getorgan(/obj/item/organ/internal/eyes) if(my_eyes) - my_eyes.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - my_eyes.see_in_dark = 8 + my_eyes.color_cutoffs = list(10, 30, 10) my_eyes.flash_protect = FLASH_PROTECTION_SENSITIVE current_user.add_client_colour(/datum/client_colour/glass_colour/lightgreen) @@ -238,8 +237,7 @@ if(current_user) var/obj/item/organ/internal/eyes/my_eyes = current_user.getorgan(/obj/item/organ/internal/eyes) if(my_eyes) - my_eyes.lighting_alpha = initial(my_eyes.lighting_alpha) - my_eyes.see_in_dark = initial(my_eyes.see_in_dark) + my_eyes.color_cutoffs = initial(my_eyes.color_cutoffs) my_eyes.flash_protect = initial(my_eyes.flash_protect) current_user.remove_client_colour(/datum/client_colour/glass_colour/lightgreen) current_user.update_sight() diff --git a/modular_skyrat/modules/horrorform/code/true_changeling.dm b/modular_skyrat/modules/horrorform/code/true_changeling.dm index 9e9f4bd408e..6bcc461aa33 100644 --- a/modular_skyrat/modules/horrorform/code/true_changeling.dm +++ b/modular_skyrat/modules/horrorform/code/true_changeling.dm @@ -23,8 +23,9 @@ maxHealth = 750 //Very durable health = 500 healable = FALSE - see_in_dark = 8 - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE + lighting_cutoff_red = 0 + lighting_cutoff_green = 35 + lighting_cutoff_blue = 20 environment_smash = ENVIRONMENT_SMASH_STRUCTURES melee_damage_lower = 40 melee_damage_upper = 40 diff --git a/modular_skyrat/modules/loadouts/loadout_items/loadout_datum_glasses.dm b/modular_skyrat/modules/loadouts/loadout_items/loadout_datum_glasses.dm index f356e8a0e33..96b3aa755b0 100644 --- a/modular_skyrat/modules/loadouts/loadout_items/loadout_datum_glasses.dm +++ b/modular_skyrat/modules/loadouts/loadout_items/loadout_datum_glasses.dm @@ -30,10 +30,9 @@ GLOBAL_LIST_INIT(loadout_glasses, generate_loadout_items(/datum/loadout_item/gla if(equipped_glasses.tint) equipper.update_tint() if(equipped_glasses.vision_flags \ - || equipped_glasses.darkness_view \ || equipped_glasses.invis_override \ || equipped_glasses.invis_view \ - || !isnull(equipped_glasses.lighting_alpha)) + || !isnull(equipped_glasses.color_cutoffs)) equipper.update_sight() /* * PRESCRIPTION GLASSES diff --git a/modular_skyrat/modules/modular_items/code/modular_glasses.dm b/modular_skyrat/modules/modular_items/code/modular_glasses.dm index c193f1f80f7..a47aaa233c4 100644 --- a/modular_skyrat/modules/modular_items/code/modular_glasses.dm +++ b/modular_skyrat/modules/modular_items/code/modular_glasses.dm @@ -27,7 +27,7 @@ /obj/item/clothing/glasses/hud/ar/Initialize(mapload) . = ..() AddElement(/datum/element/update_icon_updates_onmob, ITEM_SLOT_EYES) - + // Set our initial values mode = MODE_ON glasses_type = type @@ -43,12 +43,12 @@ if(mode == modes[mode]) return // If there is only really one mode to cycle through, early return - + if(mode == MODE_FREEZE_ANIMATION) icon = initial(glasses_type.icon) /// Resets icon to initial value after MODE_FREEZE_ANIMATION, since MODE_FREEZE_ANIMATION replaces it with non-animated version of initial mode = get_next_mode(mode) - + switch(mode) if(MODE_ON) balloon_alert(user, span_notice("[modes_msg[mode]]")) @@ -66,7 +66,7 @@ icon_state = off_state disable_vars(user) remove_hud(user) - + playsound(src, modeswitch_sound, 50, TRUE) // play sound set in vars! update_sight(user) update_item_action_buttons() @@ -80,22 +80,22 @@ else return MODE_OFF if(MODE_OFF) - return MODE_ON + return MODE_ON if(MODE_FREEZE_ANIMATION) return MODE_OFF /obj/item/clothing/glasses/hud/ar/proc/add_hud(mob/user) if(ishuman(user)) // Make sure they're a human wearing the glasses first var/mob/living/carbon/human/human = user - if(human.glasses == src) + if(human.glasses == src) var/datum/atom_hud/our_hud = GLOB.huds[initial(glasses_type.hud_type)] our_hud.show_to(human) ADD_TRAIT(human, initial(glasses_type.hud_trait), GLASSES_TRAIT) - + /obj/item/clothing/glasses/hud/ar/proc/remove_hud(mob/user) if(ishuman(user)) // Make sure they're a human wearing the glasses first var/mob/living/carbon/human/human = user - if(human.glasses == src) + if(human.glasses == src) var/datum/atom_hud/our_hud = GLOB.huds[initial(glasses_type.hud_type)] our_hud.hide_from(human) REMOVE_TRAIT(human, initial(glasses_type.hud_trait), GLASSES_TRAIT) @@ -105,7 +105,7 @@ icon_state = initial(glasses_type.icon_state) flash_protect = initial(glasses_type.flash_protect) tint = initial(glasses_type.tint) - lighting_alpha = initial(glasses_type.lighting_alpha) + color_cutoffs = initial(glasses_type.color_cutoffs) vision_flags = initial(glasses_type.vision_flags) hud_type = initial(glasses_type.hud_type) hud_trait = initial(glasses_type.hud_trait) @@ -113,10 +113,10 @@ var/obj/item/clothing/glasses/hud/ar/glasses_object = new glasses_type // make a temporary glasses obj clothing_traits = glasses_object.clothing_traits // pull the list from the created obj qdel(glasses_object) // delete the object - + /obj/item/clothing/glasses/hud/ar/proc/disable_vars(mob/user) vision_flags = 0 /// Sets vision_flags to 0 to disable meson view mainly - lighting_alpha = user.default_lighting_alpha() // Resets lighting_alpha to user's default one + color_cutoffs = null // Resets lighting_alpha to user's default one clothing_traits = null /// also disables the options for Science functionality hud_type = null hud_trait = null @@ -146,7 +146,6 @@ icon_state = "aviator" off_state = "aviator_off" icon = 'modular_skyrat/modules/modular_items/icons/modular_glasses.dmi' - darkness_view = 1 flash_protect = FLASH_PROTECTION_FLASH modes = list(MODE_OFF, MODE_ON) tint = 0 @@ -188,9 +187,8 @@ icon_state = "aviator_meson" flash_protect = FLASH_PROTECTION_NONE clothing_traits = list(TRAIT_MADNESS_IMMUNE) - darkness_view = 2 vision_flags = SEE_TURFS - lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE + color_cutoffs = list(5, 15, 5) glass_colour_type = /datum/client_colour/glass_colour/lightgreen // diagnostic Aviators @@ -259,9 +257,8 @@ /obj/item/clothing/glasses/hud/ar/projector/meson name = "retinal projector meson HUD" icon_state = "projector_meson" - lighting_alpha = 300 vision_flags = SEE_TURFS - darkness_view = 2 + color_cutoffs = list(10, 30, 10) /obj/item/clothing/glasses/hud/ar/projector/health name = "retinal projector health HUD" diff --git a/modular_skyrat/modules/mutants/code/mutant_species.dm b/modular_skyrat/modules/mutants/code/mutant_species.dm index a622c5477a3..48861baaa74 100644 --- a/modular_skyrat/modules/mutants/code/mutant_species.dm +++ b/modular_skyrat/modules/mutants/code/mutant_species.dm @@ -66,7 +66,7 @@ id = SPECIES_MUTANT_INFECTIOUS speedmod = 1 armor = 10 - mutanteyes = /obj/item/organ/internal/eyes/night_vision/zombie + mutanteyes = /obj/item/organ/internal/eyes/zombie changesource_flags = MIRROR_BADMIN | WABBAJACK | ERT_SPAWN var/hands_to_give = /obj/item/hnz_mutant_hand /// The rate the mutants regenerate at diff --git a/tgstation.dme b/tgstation.dme index b694fa7a0d3..b367dac322b 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4766,7 +4766,6 @@ #include "code\modules\spells\spell_types\self\lichdom.dm" #include "code\modules\spells\spell_types\self\mime_vow.dm" #include "code\modules\spells\spell_types\self\mutate.dm" -#include "code\modules\spells\spell_types\self\night_vision.dm" #include "code\modules\spells\spell_types\self\personality_commune.dm" #include "code\modules\spells\spell_types\self\rod_form.dm" #include "code\modules\spells\spell_types\self\sanguine_strike.dm"