diff --git a/code/controllers/subsystem/lighting.dm b/code/controllers/subsystem/lighting.dm index 252f2dcb2c8..82bbd52471a 100644 --- a/code/controllers/subsystem/lighting.dm +++ b/code/controllers/subsystem/lighting.dm @@ -16,7 +16,7 @@ SUBSYSTEM_DEF(lighting) if(config.starlight) for(var/I in GLOB.all_areas) var/area/A = I - if (A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT) + if(A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT) A.luminosity = 0 create_all_lighting_objects() @@ -40,7 +40,7 @@ SUBSYSTEM_DEF(lighting) if(init_tick_checks) CHECK_TICK - else if (MC_TICK_CHECK) + else if(MC_TICK_CHECK) break if(i) GLOB.lighting_update_lights.Cut(1, i+1) @@ -56,9 +56,9 @@ SUBSYSTEM_DEF(lighting) C.needs_update = FALSE if(init_tick_checks) CHECK_TICK - else if (MC_TICK_CHECK) + else if(MC_TICK_CHECK) break - if (i) + if(i) GLOB.lighting_update_corners.Cut(1, i+1) i = 0 @@ -69,16 +69,16 @@ SUBSYSTEM_DEF(lighting) for (i in 1 to GLOB.lighting_update_objects.len) var/atom/movable/lighting_object/O = GLOB.lighting_update_objects[i] - if (QDELETED(O)) + if(QDELETED(O)) continue O.update() O.needs_update = FALSE if(init_tick_checks) CHECK_TICK - else if (MC_TICK_CHECK) + else if(MC_TICK_CHECK) break - if (i) + if(i) GLOB.lighting_update_objects.Cut(1, i+1) diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index f38958e0c2b..e4274d18d49 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -218,7 +218,7 @@ name = "zealot's blindfold" icon_state = "blindfold" item_state = "blindfold" - darkness_view = 8 + see_in_dark = 8 flash_protect = 1 /obj/item/clothing/glasses/night/cultblind/equipped(mob/user, slot) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 5cf32951e11..13df41fe531 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -496,22 +496,22 @@ return var/upgradedcams = 0 - see_override = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE //Night-vision, without which X-ray would be very limited in power. + RegisterSignal(src, COMSIG_MOB_UPDATE_SIGHT, .proc/update_upgraded_cameras_sight) //Makes sure the AI has night vision, without which X-ray would be very limited in power. update_sight() for(var/obj/machinery/camera/C in cameranet.cameras) if(C.assembly) - var/upgraded = 0 + var/upgraded = FALSE if(!C.isXRay()) C.upgradeXRay() //Update what it can see. cameranet.updateVisibility(C, 0) - upgraded = 1 + upgraded = TRUE if(!C.isEmpProof()) C.upgradeEmpProof() - upgraded = 1 + upgraded = TRUE if(upgraded) upgradedcams++ @@ -519,6 +519,8 @@ to_chat(src, "OTA firmware distribution complete! Cameras upgraded: [upgradedcams]. Light amplification system online.") verbs -= /mob/living/silicon/ai/proc/upgrade_cameras +/mob/living/silicon/ai/proc/update_upgraded_cameras_sight() + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE /datum/AI_Module/large/eavesdrop module_name = "Enhanced Surveillance" diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 5e103f14c72..d339f767865 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -151,7 +151,7 @@ slot_flags = SLOT_EYES materials = list(MAT_GLASS = 250) var/vision_flags = 0 - var/darkness_view = 0 //Base human is 2 + var/see_in_dark = 0 //Base human is 2 var/invis_view = SEE_INVISIBLE_LIVING var/invis_override = 0 var/lighting_alpha @@ -284,7 +284,7 @@ BLIND // can't see anything var/HUDType = null var/vision_flags = 0 - var/darkness_view = 0 + var/see_in_dark = 0 var/lighting_alpha var/can_toggle = null diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 6a7da898b25..3a427d96bec 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -52,7 +52,7 @@ icon_state = "nvgmeson" item_state = "glasses" origin_tech = "magnets=4;engineering=5;plasmatech=4" - darkness_view = 8 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE prescription_upgradable = 0 @@ -104,7 +104,7 @@ desc = "Now you can science in darkness." icon_state = "nvpurple" item_state = "glasses" - darkness_view = 8 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE //don't render darkness while wearing these /obj/item/clothing/glasses/janitor @@ -123,7 +123,7 @@ icon_state = "night" item_state = "glasses" origin_tech = "materials=4;magnets=4;plasmatech=4;engineering=4" - darkness_view = 8 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE //don't render darkness while wearing these species_fit = list("Vox") sprite_sheets = list( @@ -224,7 +224,7 @@ name = "sunglasses" icon_state = "sun" item_state = "sunglasses" - darkness_view = 1 + see_in_dark = 1 flash_protect = 1 tint = 1 prescription_upgradable = 1 @@ -238,7 +238,7 @@ /obj/item/clothing/glasses/sunglasses/fake desc = "Cheap, plastic sunglasses. They don't even have UV protection." name = "cheap sunglasses" - darkness_view = 0 + see_in_dark = 0 flash_protect = 0 tint = 0 @@ -286,7 +286,7 @@ name = "sunglasses" icon_state = "sun" item_state = "sunglasses" - darkness_view = 1 + see_in_dark = 1 flash_protect = 1 tint = 1 species_fit = list("Vox") @@ -505,11 +505,11 @@ icon_state = "godeye" item_state = "godeye" vision_flags = SEE_TURFS|SEE_MOBS|SEE_OBJS - darkness_view = 8 + see_in_dark = 8 scan_reagents = 1 flags = NODROP flags_cover = null - lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE /obj/item/clothing/glasses/godeye/attackby(obj/item/W as obj, mob/user as mob, params) if(istype(W, src) && W != src && W.loc == user) diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index ad775b04c14..7f5d73acb1d 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -50,7 +50,7 @@ icon_state = "healthhudnight" item_state = "glasses" origin_tech = "magnets=4;biotech=4;plasmatech=4;engineering=5" - darkness_view = 8 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE prescription_upgradable = 0 @@ -72,7 +72,7 @@ icon_state = "diagnostichudnight" item_state = "glasses" origin_tech = "magnets=4;powerstorage=4;plasmatech=4;engineering=5" - darkness_view = 8 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE prescription_upgradable = 0 @@ -112,7 +112,7 @@ desc = "An advanced heads-up display which provides id data and vision in complete darkness." icon_state = "securityhudnight" origin_tech = "magnets=4;combat=4;plasmatech=4;engineering=5" - darkness_view = 8 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE //don't render darkness while wearing these prescription_upgradable = 0 @@ -124,7 +124,7 @@ desc = "Sunglasses with a HUD." icon_state = "sunhud" origin_tech = "magnets=3;combat=3;engineering=3" - darkness_view = 1 + see_in_dark = 1 flash_protect = 1 tint = 1 prescription_upgradable = 1 @@ -154,7 +154,7 @@ desc = "A hydroponic HUD fitted with a light amplifier." icon_state = "hydroponichudnight" item_state = "glasses" - darkness_view = 8 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE prescription_upgradable = 0 diff --git a/code/modules/clothing/spacesuits/miscellaneous.dm b/code/modules/clothing/spacesuits/miscellaneous.dm index 6b86d8f5d5c..91b28ad3206 100644 --- a/code/modules/clothing/spacesuits/miscellaneous.dm +++ b/code/modules/clothing/spacesuits/miscellaneous.dm @@ -48,6 +48,7 @@ unacidable = 1 vision_flags = SEE_MOBS lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE //don't render darkness while wearing these + see_in_dark = 8 HUDType = MEDHUD strip_delay = 130 diff --git a/code/modules/lighting/lighting_area.dm b/code/modules/lighting/lighting_area.dm index 58e9a4337a5..77e955d10a6 100644 --- a/code/modules/lighting/lighting_area.dm +++ b/code/modules/lighting/lighting_area.dm @@ -3,21 +3,21 @@ var/dynamic_lighting = DYNAMIC_LIGHTING_ENABLED /area/proc/set_dynamic_lighting(var/new_dynamic_lighting = DYNAMIC_LIGHTING_ENABLED) - if (new_dynamic_lighting == dynamic_lighting) + if(new_dynamic_lighting == dynamic_lighting) return FALSE dynamic_lighting = new_dynamic_lighting - if (IS_DYNAMIC_LIGHTING(src)) + if(IS_DYNAMIC_LIGHTING(src)) cut_overlay(/obj/effect/fullbright) for (var/turf/T in src) - if (IS_DYNAMIC_LIGHTING(T)) + if(IS_DYNAMIC_LIGHTING(T)) T.lighting_build_overlay() else add_overlay(/obj/effect/fullbright) for (var/turf/T in src) - if (T.lighting_object) + if(T.lighting_object) T.lighting_clear_overlay() return TRUE diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index 85c857ab804..ff4bc517979 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -13,13 +13,13 @@ /atom/proc/set_light(var/l_range, var/l_power, var/l_color = NONSENSICAL_VALUE) if(l_range > 0 && l_range < MINIMUM_USEFUL_LIGHT_RANGE) l_range = MINIMUM_USEFUL_LIGHT_RANGE //Brings the range up to 1.4, which is just barely brighter than the soft lighting that surrounds players. - if (l_power != null) + if(l_power != null) light_power = l_power - if (l_range != null) + if(l_range != null) light_range = l_range - if (l_color != NONSENSICAL_VALUE) + if(l_color != NONSENSICAL_VALUE) light_color = l_color SEND_SIGNAL(src, COMSIG_ATOM_SET_LIGHT, l_range, l_power, l_color) @@ -32,18 +32,18 @@ // Creates or destroys it if needed, makes it update values, makes sure it's got the correct source turf... /atom/proc/update_light() set waitfor = FALSE - if (QDELETED(src)) + if(QDELETED(src)) return - if (!light_power || !light_range) // We won't emit light anyways, destroy the light source. + if(!light_power || !light_range) // We won't emit light anyways, destroy the light source. QDEL_NULL(light) else - if (!ismovableatom(loc)) // We choose what atom should be the top atom of the light here. + if(!ismovableatom(loc)) // We choose what atom should be the top atom of the light here. . = src else . = loc - if (light) // Update the light or create it if it does not exist. + if(light) // Update the light or create it if it does not exist. light.update(.) else light = new/datum/light_source(src, .) @@ -55,30 +55,30 @@ /atom/movable/Destroy() var/turf/T = loc . = ..() - if (opacity && istype(T)) + if(opacity && istype(T)) var/old_has_opaque_atom = T.has_opaque_atom T.recalc_atom_opacity() - if (old_has_opaque_atom != T.has_opaque_atom) + if(old_has_opaque_atom != T.has_opaque_atom) T.reconsider_lights() // Should always be used to change the opacity of an atom. // It notifies (potentially) affected light sources so they can update (if needed). /atom/proc/set_opacity(var/new_opacity) - if (new_opacity == opacity) + if(new_opacity == opacity) return opacity = new_opacity var/turf/T = loc - if (!isturf(T)) + if(!isturf(T)) return - if (new_opacity == TRUE) + if(new_opacity == TRUE) T.has_opaque_atom = TRUE T.reconsider_lights() else var/old_has_opaque_atom = T.has_opaque_atom T.recalc_atom_opacity() - if (old_has_opaque_atom != T.has_opaque_atom) + if(old_has_opaque_atom != T.has_opaque_atom) T.reconsider_lights() @@ -92,15 +92,15 @@ /atom/vv_edit_var(var_name, var_value) switch (var_name) - if ("light_range") + if("light_range") set_light(l_range=var_value) return TRUE - if ("light_power") + if("light_power") set_light(l_power=var_value) return TRUE - if ("light_color") + if("light_color") set_light(l_color=var_value) return TRUE diff --git a/code/modules/lighting/lighting_corner.dm b/code/modules/lighting/lighting_corner.dm index e12876dbcc2..d8b05d0c17f 100644 --- a/code/modules/lighting/lighting_corner.dm +++ b/code/modules/lighting/lighting_corner.dm @@ -45,8 +45,8 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, // Diagonal one is easy. T = get_step(new_turf, diagonal) - if (T) // In case we're on the map's border. - if (!T.corners) + if(T) // In case we're on the map's border. + if(!T.corners) T.corners = list(null, null, null, null) masters[T] = diagonal @@ -55,8 +55,8 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, // Now the horizontal one. T = get_step(new_turf, horizontal) - if (T) // Ditto. - if (!T.corners) + if(T) // Ditto. + if(!T.corners) T.corners = list(null, null, null, null) masters[T] = ((T.x > x) ? EAST : WEST) | ((T.y > y) ? NORTH : SOUTH) // Get the dir based on coordinates. @@ -65,8 +65,8 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, // And finally the vertical one. T = get_step(new_turf, vertical) - if (T) - if (!T.corners) + if(T) + if(!T.corners) T.corners = list(null, null, null, null) masters[T] = ((T.x > x) ? EAST : WEST) | ((T.y > y) ? NORTH : SOUTH) // Get the dir based on coordinates. @@ -81,20 +81,20 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, var/thing for (thing in masters) T = thing - if (T.lighting_object) + if(T.lighting_object) active = TRUE // God that was a mess, now to do the rest of the corner code! Hooray! /datum/lighting_corner/proc/update_lumcount(var/delta_r, var/delta_g, var/delta_b) - if ((abs(delta_r)+abs(delta_g)+abs(delta_b)) == 0) + if((abs(delta_r)+abs(delta_g)+abs(delta_b)) == 0) return lum_r += delta_r lum_g += delta_g lum_b += delta_b - if (!needs_update) + if(!needs_update) needs_update = TRUE GLOB.lighting_update_corners += src @@ -105,11 +105,11 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, var/lum_b = src.lum_b var/mx = max(lum_r, lum_g, lum_b) // Scale it so one of them is the strongest lum, if it is above 1. . = 1 // factor - if (mx > 1) + if(mx > 1) . = 1 / mx #if LIGHTING_SOFT_THRESHOLD != 0 - else if (mx < LIGHTING_SOFT_THRESHOLD) + else if(mx < LIGHTING_SOFT_THRESHOLD) . = 0 // 0 means soft lighting. cache_r = round(lum_r * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD @@ -124,8 +124,8 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, for (var/TT in masters) var/turf/T = TT - if (T.lighting_object) - if (!T.lighting_object.needs_update) + if(T.lighting_object) + if(!T.lighting_object.needs_update) T.lighting_object.needs_update = TRUE GLOB.lighting_update_objects += T.lighting_object @@ -135,7 +135,7 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, /datum/lighting_corner/Destroy(var/force) - if (!force) + if(!force) return QDEL_HINT_LETMELIVE stack_trace("Attempted qdel of a lighting corner.") diff --git a/code/modules/lighting/lighting_object.dm b/code/modules/lighting/lighting_object.dm index 586668ec139..c233c887c9a 100644 --- a/code/modules/lighting/lighting_object.dm +++ b/code/modules/lighting/lighting_object.dm @@ -19,7 +19,7 @@ verbs.Cut() myturf = loc - if (myturf.lighting_object) + if(myturf.lighting_object) qdel(myturf.lighting_object, force = TRUE) myturf.lighting_object = src myturf.luminosity = 0 @@ -31,13 +31,13 @@ GLOB.lighting_update_objects += src /atom/movable/lighting_object/Destroy(var/force) - if (force) + if(force) GLOB.lighting_update_objects -= src - if (loc != myturf) + if(loc != myturf) var/turf/oldturf = get_turf(myturf) var/turf/newturf = get_turf(loc) stack_trace("A lighting object was qdeleted with a different loc then it is suppose to have ([COORD(oldturf)] -> [COORD(newturf)])") - if (isturf(myturf)) + if(isturf(myturf)) myturf.lighting_object = null myturf.luminosity = 1 myturf = null @@ -48,8 +48,8 @@ return QDEL_HINT_LETMELIVE /atom/movable/lighting_object/proc/update() - if (loc != myturf) - if (loc) + if(loc != myturf) + if(loc) var/turf/oldturf = get_turf(myturf) var/turf/newturf = get_turf(loc) warning("A lighting object realised it's loc had changed in update() ([myturf]\[[myturf ? myturf.type : "null"]]([COORD(oldturf)]) -> [loc]\[[ loc ? loc.type : "null"]]([COORD(newturf)]))!") @@ -73,7 +73,7 @@ var/datum/lighting_corner/cg = dummy_lighting_corner var/datum/lighting_corner/cb = dummy_lighting_corner var/datum/lighting_corner/ca = dummy_lighting_corner - if (corners) //done this way for speed + if(corners) //done this way for speed cr = corners[3] || dummy_lighting_corner cg = corners[2] || dummy_lighting_corner cb = corners[4] || dummy_lighting_corner diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index b6dbd778371..207a91d58b4 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -33,7 +33,7 @@ source_atom = owner // Set our new owner. LAZYADD(source_atom.light_sources, src) top_atom = top - if (top_atom != source_atom) + if(top_atom != source_atom) LAZYADD(top_atom.light_sources, src) source_turf = top_atom @@ -51,13 +51,13 @@ /datum/light_source/Destroy(force) remove_lum() - if (source_atom) + if(source_atom) LAZYREMOVE(source_atom.light_sources, src) - if (top_atom) + if(top_atom) LAZYREMOVE(top_atom.light_sources, src) - if (needs_update) + if(needs_update) GLOB.lighting_update_lights -= src . = ..() @@ -66,22 +66,22 @@ // If you want it to go switch everybody to elastic tab stops. // Actually that'd be great if you could! #define EFFECT_UPDATE(level) \ - if (needs_update == LIGHTING_NO_UPDATE) \ + if(needs_update == LIGHTING_NO_UPDATE) \ GLOB.lighting_update_lights += src; \ - if (needs_update < level) \ + if(needs_update < level) \ needs_update = level; \ // This proc will cause the light source to update the top atom, and add itself to the update queue. /datum/light_source/proc/update(var/atom/new_top_atom) // This top atom is different. - if (new_top_atom && new_top_atom != top_atom) + if(new_top_atom && new_top_atom != top_atom) if(top_atom != source_atom && top_atom.light_sources) // Remove ourselves from the light sources of that top atom. LAZYREMOVE(top_atom.light_sources, src) top_atom = new_top_atom - if (top_atom != source_atom) + if(top_atom != source_atom) LAZYADD(top_atom.light_sources, src) // Add ourselves to the light sources of our new top atom. EFFECT_UPDATE(LIGHTING_CHECK_UPDATE) @@ -96,7 +96,7 @@ // Decompile the hexadecimal colour into lumcounts of each perspective. /datum/light_source/proc/parse_light_color() - if (light_color) + if(light_color) lum_r = GetRedPart (light_color) / 255 lum_g = GetGreenPart (light_color) / 255 lum_b = GetBluePart (light_color) / 255 @@ -156,7 +156,7 @@ /datum/light_source/proc/recalc_corner(var/datum/lighting_corner/C) LAZYINITLIST(effect_str) - if (effect_str[C]) // Already have one. + if(effect_str[C]) // Already have one. REMOVE_CORNER(C) effect_str[C] = 0 @@ -167,61 +167,61 @@ var/update = FALSE var/atom/source_atom = src.source_atom - if (QDELETED(source_atom)) + if(QDELETED(source_atom)) qdel(src) return - if (source_atom.light_power != light_power) + if(source_atom.light_power != light_power) light_power = source_atom.light_power update = TRUE - if (source_atom.light_range != light_range) + if(source_atom.light_range != light_range) light_range = source_atom.light_range update = TRUE - if (!top_atom) + if(!top_atom) top_atom = source_atom update = TRUE - if (!light_range || !light_power) + if(!light_range || !light_power) qdel(src) return - if (isturf(top_atom)) - if (source_turf != top_atom) + if(isturf(top_atom)) + if(source_turf != top_atom) source_turf = top_atom pixel_turf = source_turf update = TRUE - else if (top_atom.loc != source_turf) + else if(top_atom.loc != source_turf) source_turf = top_atom.loc pixel_turf = get_turf_pixel(top_atom) update = TRUE else var/P = get_turf_pixel(top_atom) - if (P != pixel_turf) + if(P != pixel_turf) pixel_turf = P update = TRUE - if (!isturf(source_turf)) - if (applied) + if(!isturf(source_turf)) + if(applied) remove_lum() return - if (light_range && light_power && !applied) + if(light_range && light_power && !applied) update = TRUE - if (source_atom.light_color != light_color) + if(source_atom.light_color != light_color) light_color = source_atom.light_color parse_light_color() update = TRUE - else if (applied_lum_r != lum_r || applied_lum_g != lum_g || applied_lum_b != lum_b) + else if(applied_lum_r != lum_r || applied_lum_g != lum_g || applied_lum_b != lum_b) update = TRUE - if (update) + if(update) needs_update = LIGHTING_CHECK_UPDATE applied = TRUE - else if (needs_update == LIGHTING_CHECK_UPDATE) + else if(needs_update == LIGHTING_CHECK_UPDATE) return //nothing's changed var/list/datum/lighting_corner/corners = list() @@ -229,7 +229,7 @@ var/thing var/datum/lighting_corner/C var/turf/T - if (source_turf) + if(source_turf) var/oldlum = source_turf.luminosity source_turf.luminosity = CEILING(light_range, 1) for(T in view(CEILING(light_range, 1), source_turf)) @@ -253,11 +253,11 @@ LAZYREMOVE(T.affecting_lights, src) LAZYINITLIST(effect_str) - if (needs_update == LIGHTING_VIS_UPDATE) + if(needs_update == LIGHTING_VIS_UPDATE) for (thing in corners - effect_str) // New corners C = thing LAZYADD(C.affecting, src) - if (!C.active) + if(!C.active) effect_str[C] = 0 continue APPLY_CORNER(C) @@ -266,14 +266,14 @@ for (thing in L) // New corners C = thing LAZYADD(C.affecting, src) - if (!C.active) + if(!C.active) effect_str[C] = 0 continue APPLY_CORNER(C) for (thing in corners - L) // Existing corners C = thing - if (!C.active) + if(!C.active) effect_str[C] = 0 continue APPLY_CORNER(C) diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index 0fe3caec840..c2198cea650 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -18,7 +18,7 @@ L.vis_update() /turf/proc/lighting_clear_overlay() - if (lighting_object) + if(lighting_object) qdel(lighting_object, TRUE) var/datum/lighting_corner/C @@ -31,14 +31,14 @@ // Builds a lighting object for us, but only if our area is dynamic. /turf/proc/lighting_build_overlay() - if (lighting_object) + if(lighting_object) qdel(lighting_object,force=TRUE) //Shitty fix for lighting objects persisting after death var/area/A = loc - if (!IS_DYNAMIC_LIGHTING(A) && !light_sources) + if(!IS_DYNAMIC_LIGHTING(A) && !light_sources) return - if (!lighting_corners_initialised) + if(!lighting_corners_initialised) generate_missing_corners() new/atom/movable/lighting_object(src) @@ -50,7 +50,7 @@ if(!thing) continue C = thing - if (!C.active) // We would activate the corner, calculate the lighting for it. + if(!C.active) // We would activate the corner, calculate the lighting for it. for (thing in C.affecting) S = thing S.recalc_corner(C) @@ -58,7 +58,7 @@ // Used to get a scaled lumcount. /turf/proc/get_lumcount(var/minlum = 0, var/maxlum = 1) - if (!lighting_object) + if(!lighting_object) return 1 var/totallums = 0 @@ -81,7 +81,7 @@ // itself as too dark to allow sight and see_in_dark becomes useful. // So basically if this returns true the tile is unlit black. /turf/proc/is_softly_lit() - if (!lighting_object) + if(!lighting_object) return FALSE return !lighting_object.luminosity @@ -89,46 +89,46 @@ // Can't think of a good name, this proc will recalculate the has_opaque_atom variable. /turf/proc/recalc_atom_opacity() has_opaque_atom = opacity - if (!has_opaque_atom) + if(!has_opaque_atom) for (var/atom/A in src.contents) // Loop through every movable atom on our tile PLUS ourselves (we matter too...) - if (A.opacity) + if(A.opacity) has_opaque_atom = TRUE break /turf/Exited(atom/movable/Obj, atom/newloc) . = ..() - if (Obj && Obj.opacity) + if(Obj && Obj.opacity) recalc_atom_opacity() // Make sure to do this before reconsider_lights(), incase we're on instant updates. reconsider_lights() /turf/proc/change_area(var/area/old_area, var/area/new_area) if(SSlighting.initialized) - if (new_area.dynamic_lighting != old_area.dynamic_lighting) - if (new_area.dynamic_lighting) + if(new_area.dynamic_lighting != old_area.dynamic_lighting) + if(new_area.dynamic_lighting) lighting_build_overlay() else lighting_clear_overlay() /turf/proc/get_corners() - if (!IS_DYNAMIC_LIGHTING(src) && !light_sources) + if(!IS_DYNAMIC_LIGHTING(src) && !light_sources) return null - if (!lighting_corners_initialised) + if(!lighting_corners_initialised) generate_missing_corners() - if (has_opaque_atom) + if(has_opaque_atom) return null // Since this proc gets used in a for loop, null won't be looped though. return corners /turf/proc/generate_missing_corners() - if (!IS_DYNAMIC_LIGHTING(src) && !light_sources) + if(!IS_DYNAMIC_LIGHTING(src) && !light_sources) return lighting_corners_initialised = TRUE - if (!corners) + if(!corners) corners = list(null, null, null, null) for (var/i = 1 to 4) - if (corners[i]) // Already have a corner on this direction. + if(corners[i]) // Already have a corner on this direction. continue corners[i] = new/datum/lighting_corner(src, GLOB.LIGHTING_CORNER_DIAGONAL[i]) diff --git a/code/modules/mining/lavaland/loot/tendril_loot.dm b/code/modules/mining/lavaland/loot/tendril_loot.dm index ac3ec9d04c3..3c154e351c7 100644 --- a/code/modules/mining/lavaland/loot/tendril_loot.dm +++ b/code/modules/mining/lavaland/loot/tendril_loot.dm @@ -244,7 +244,6 @@ user.sight |= sight_flags if(!isnull(lighting_alpha)) user.lighting_alpha = min(user.lighting_alpha, lighting_alpha) - user.sync_lighting_plane_alpha() /obj/effect/wisp name = "friendly wisp" diff --git a/code/modules/mob/camera/camera.dm b/code/modules/mob/camera/camera.dm index bfeecdef055..df6fd57423d 100644 --- a/code/modules/mob/camera/camera.dm +++ b/code/modules/mob/camera/camera.dm @@ -7,7 +7,7 @@ move_resist = INFINITY status_flags = GODMODE // You can't damage it. mouse_opacity = MOUSE_OPACITY_TRANSPARENT - see_in_dark = 7 + see_in_dark = 8 invisibility = 101 // No one can see us sight = SEE_SELF move_on_shuttle = 0 diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 84bb5af399d..e6dcaebf51c 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -297,10 +297,7 @@ Des: Removes all infected images from the alien. if(E.see_invisible) see_invisible = min(see_invisible, E.see_invisible) if(!isnull(E.lighting_alpha)) - lighting_alpha = min(lighting_alpha, E.lighting_alpha) + lighting_alpha = min(lighting_alpha, E.lighting_alpha) - if(see_override) - see_invisible = see_override - - sync_lighting_plane_alpha() - SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) \ No newline at end of file + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) + sync_lighting_plane_alpha() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index c2a01eee4f7..44a333fbe44 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -1160,8 +1160,6 @@ so that different stomachs can handle things in different ways VB*/ sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS) see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - - if(see_override) - see_invisible = see_override - + SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) + sync_lighting_plane_alpha() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f094f5611a6..01faa9d9422 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -552,6 +552,7 @@ dna.species.update_sight(src) SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) + sync_lighting_plane_alpha() //Added a safety check in case you want to shock a human mob directly through electrocute_act. /mob/living/carbon/human/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = FALSE, override = FALSE, tesla_shock = FALSE, illusion = FALSE, stun = TRUE) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index ba4f2fbbcf4..9e6ab986395 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -115,7 +115,7 @@ update_tint() if(G.prescription) update_nearsighted_effects() - if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) + if(G.vision_flags || G.see_in_dark || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) update_sight() update_inv_glasses() update_client_colour() @@ -128,7 +128,7 @@ // Bandanas and paper hats go on the head but are not head clothing if(istype(I,/obj/item/clothing/head)) var/obj/item/clothing/head/hat = I - if(hat.vision_flags || hat.darkness_view || !isnull(hat.lighting_alpha)) + if(hat.vision_flags || hat.see_in_dark || !isnull(hat.lighting_alpha)) update_sight() head_update(I) update_inv_head() @@ -267,7 +267,7 @@ update_tint() if(G.prescription) update_nearsighted_effects() - if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) + if(G.vision_flags || G.see_in_dark || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) update_sight() update_inv_glasses(redraw_mob) update_client_colour() @@ -283,7 +283,7 @@ // paper + bandanas if(istype(W, /obj/item/clothing/head)) var/obj/item/clothing/head/hat = W - if(hat.vision_flags || hat.darkness_view || !isnull(hat.lighting_alpha)) + if(hat.vision_flags || hat.see_in_dark || !isnull(hat.lighting_alpha)) update_sight() head_update(W) update_inv_head(redraw_mob) diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index c24a066f073..7990dbad915 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -668,7 +668,7 @@ It'll return null if the organ doesn't correspond, so include null checks when u if(H.glasses) var/obj/item/clothing/glasses/G = H.glasses H.sight |= G.vision_flags - H.see_in_dark = max(G.darkness_view, H.see_in_dark) + H.see_in_dark = max(G.see_in_dark, H.see_in_dark) if(G.invis_override) H.see_invisible = G.invis_override @@ -683,7 +683,7 @@ It'll return null if the organ doesn't correspond, so include null checks when u if(istype(H.head, /obj/item/clothing/head)) var/obj/item/clothing/head/hat = H.head H.sight |= hat.vision_flags - H.see_in_dark = max(hat.darkness_view, H.see_in_dark) + H.see_in_dark = max(hat.see_in_dark, H.see_in_dark) if(!isnull(hat.lighting_alpha)) H.lighting_alpha = min(hat.lighting_alpha, H.lighting_alpha) @@ -696,7 +696,7 @@ It'll return null if the organ doesn't correspond, so include null checks when u var/obj/item/clothing/glasses/G = rig.visor.vision.glasses if(istype(G)) H.sight |= G.vision_flags - H.see_in_dark = max(G.darkness_view, H.see_in_dark) + H.see_in_dark = max(G.see_in_dark, H.see_in_dark) H.see_invisible = min(G.invis_view, H.see_invisible) if(!isnull(G.lighting_alpha)) @@ -717,9 +717,6 @@ It'll return null if the organ doesn't correspond, so include null checks when u H.see_in_dark = 8 H.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - if(H.see_override) //Override all - H.see_invisible = H.see_override - H.sync_lighting_plane_alpha() /datum/species/proc/water_act(mob/living/carbon/human/M, volume, temperature, source) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 35ab0402b0c..4f17801111a 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -202,7 +202,7 @@ sight |= SEE_TURFS sight |= SEE_MOBS sight |= SEE_OBJS - lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE see_in_dark = 8 see_invisible = SEE_INVISIBLE_OBSERVER sync_lighting_plane_alpha() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index d339ae12dc6..4389198fd10 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -1312,8 +1312,5 @@ var/list/ai_verbs_default = list( sight = sight &~ SEE_OBJS see_in_dark = 0 - if(see_override) - see_invisible = see_override - - sync_lighting_plane_alpha() SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) + sync_lighting_plane_alpha() diff --git a/code/modules/mob/living/silicon/ai/freelook/chunk.dm b/code/modules/mob/living/silicon/ai/freelook/chunk.dm index ec2fd378ed5..4b124c364c2 100644 --- a/code/modules/mob/living/silicon/ai/freelook/chunk.dm +++ b/code/modules/mob/living/silicon/ai/freelook/chunk.dm @@ -116,7 +116,8 @@ var/turf/t = turf if(obscuredTurfs[t]) if(!t.obscured) - t.obscured = image('icons/effects/cameravis.dmi', t, null, 15) + t.obscured = image('icons/effects/cameravis.dmi', t, null, BYOND_LIGHTING_LAYER + 0.1) + t.obscured.plane = BYOND_LIGHTING_PLANE + 1 obscured += t.obscured for(var/eye in seenby) @@ -169,7 +170,8 @@ for(var/turf in obscuredTurfs) var/turf/t = turf if(!t.obscured) - t.obscured = image('icons/effects/cameravis.dmi', t, "black", 15) + t.obscured = image('icons/effects/cameravis.dmi', t, "black", BYOND_LIGHTING_LAYER + 0.1) + t.obscured.plane = BYOND_LIGHTING_PLANE + 1 obscured += t.obscured -#undef UPDATE_BUFFER \ No newline at end of file +#undef UPDATE_BUFFER diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 8084b358d96..e6a65545646 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1406,24 +1406,17 @@ var/list/robot_verbs_default = list( if(sight_mode & BORGMESON) sight |= SEE_TURFS - lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE - see_in_dark = 1 + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE if(sight_mode & BORGXRAY) sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS) see_invisible = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - see_invisible = SEE_INVISIBLE_LIVING see_in_dark = 8 if(sight_mode & BORGTHERM) sight |= SEE_MOBS lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE - see_invisible = min(see_invisible, SEE_INVISIBLE_LIVING) - see_in_dark = 8 - if(see_override) - see_invisible = see_override - - sync_lighting_plane_alpha() SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT) + sync_lighting_plane_alpha() \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm index 2b3d11357d1..91abb6b2696 100644 --- a/code/modules/mob/living/simple_animal/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs.dm @@ -168,7 +168,7 @@ melee_damage_lower = 25 melee_damage_upper = 25 attacktext = "slashes" - see_in_dark = 7 + see_in_dark = 8 attack_sound = 'sound/weapons/bladeslice.ogg' const_type = "wraith" construct_spells = list(/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/shift) 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 e45000ff34f..6795f4ccec2 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -16,7 +16,7 @@ emote_hear = list("chitters") speak_chance = 5 turns_per_move = 5 - see_in_dark = 10 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE butcher_results = list(/obj/item/reagent_containers/food/snacks/spidermeat = 2, /obj/item/reagent_containers/food/snacks/spiderleg = 8) response_help = "pets" diff --git a/code/modules/mob/living/simple_animal/hostile/statue.dm b/code/modules/mob/living/simple_animal/hostile/statue.dm index 5b9d94341ef..2416781d78d 100644 --- a/code/modules/mob/living/simple_animal/hostile/statue.dm +++ b/code/modules/mob/living/simple_animal/hostile/statue.dm @@ -33,7 +33,7 @@ animate_movement = NO_STEPS // Do not animate movement, you jump around as you're a scary statue. - see_in_dark = 13 + see_in_dark = 8 vision_range = 12 aggro_vision_range = 12 idle_vision_range = 12 diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm index 1503c2bffe6..f73ee07441a 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm @@ -94,7 +94,7 @@ var/global/list/ts_spiderling_list = list() // Vision idle_vision_range = 10 aggro_vision_range = 10 - see_in_dark = 10 + see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE sight = SEE_MOBS diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index e36e7e4a004..7a67ce911b1 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -83,7 +83,6 @@ var/obj/item/clothing/mask/wear_mask = null//Carbon var/seer = 0 //for cult//Carbon, probably Human - var/see_override = 0 var/datum/hud/hud_used = null diff --git a/code/modules/surgery/organs/augments_eyes.dm b/code/modules/surgery/organs/augments_eyes.dm index 0dc99e310cb..463911861c2 100644 --- a/code/modules/surgery/organs/augments_eyes.dm +++ b/code/modules/surgery/organs/augments_eyes.dm @@ -74,6 +74,7 @@ eye_colour = "#FFCC00" implant_color = "#FFCC00" vision_flags = SEE_MOBS + lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE flash_protect = -1 origin_tech = "materials=5;programming=4;biotech=4;magnets=4;syndicate=1" aug_message = "You see prey everywhere you look..."