diff --git a/code/__DEFINES/layers_planes.dm b/code/__DEFINES/layers_planes.dm index 37584d892d..a6e2e8a695 100644 --- a/code/__DEFINES/layers_planes.dm +++ b/code/__DEFINES/layers_planes.dm @@ -128,12 +128,17 @@ #define EMISSIVE_UNBLOCKABLE_PLANE 14 #define EMISSIVE_UNBLOCKABLE_LAYER 14 +#define EMISSIVE_LAYER_UNBLOCKABLE 14 #define EMISSIVE_UNBLOCKABLE_RENDER_TARGET "*EMISSIVE_UNBLOCKABLE_PLANE" +#define EMISSIVE_RENDER_TARGET "*EMISSIVE_PLANE" #define LIGHTING_PLANE 15 #define LIGHTING_LAYER 15 #define LIGHTING_RENDER_TARGET "LIGHT_PLANE" +#define O_LIGHTING_VISUAL_PLANE 110 +#define O_LIGHTING_VISUAL_RENDER_TARGET "O_LIGHT_VISUAL_PLANE" + #define RAD_TEXT_LAYER 15.1 #define ABOVE_LIGHTING_PLANE 16 diff --git a/code/__DEFINES/lighting.dm b/code/__DEFINES/lighting.dm index 3fba27ba52..95d91da14a 100644 --- a/code/__DEFINES/lighting.dm +++ b/code/__DEFINES/lighting.dm @@ -84,11 +84,24 @@ #define FLASH_LIGHT_POWER 3 #define FLASH_LIGHT_RANGE 3.8 +// Emissive blocking. /// Uses vis_overlays to leverage caching so that very few new items need to be made for the overlay. For anything that doesn't change outline or opaque area much or at all. #define EMISSIVE_BLOCK_GENERIC 1 /// Uses a dedicated render_target object to copy the entire appearance in real time to the blocking layer. For things that can change in appearance a lot from the base state, like humans. #define EMISSIVE_BLOCK_UNIQUE 2 +/// The color matrix applied to all emissive overlays. Should be solely dependent on alpha and not have RGB overlap with [EM_BLOCK_COLOR]. +#define EMISSIVE_COLOR list(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 1,1,1,0) +/// A globaly cached version of [EMISSIVE_COLOR] for quick access. +GLOBAL_LIST_INIT(emissive_color, EMISSIVE_COLOR) +/// The color matrix applied to all emissive blockers. Should be solely dependent on alpha and not have RGB overlap with [EMISSIVE_COLOR]. +#define EM_BLOCK_COLOR list(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 0,0,0,0) +/// A globaly cached version of [EM_BLOCK_COLOR] for quick access. +GLOBAL_LIST_INIT(em_block_color, EM_BLOCK_COLOR) +/// The color matrix used to mask out emissive blockers on the emissive plane. Alpha should default to zero, be solely dependent on the RGB value of [EMISSIVE_COLOR], and be independant of the RGB value of [EM_BLOCK_COLOR]. +#define EM_MASK_MATRIX list(0,0,0,1/3, 0,0,0,1/3, 0,0,0,1/3, 0,0,0,0, 1,1,1,0) +/// A globaly cached version of [EM_MASK_MATRIX] for quick access. +GLOBAL_LIST_INIT(em_mask_matrix, EM_MASK_MATRIX) /// Returns the red part of a #RRGGBB hex sequence as number #define GETREDPART(hexa) hex2num(copytext(hexa, 2, 4)) diff --git a/code/__HELPERS/lighting.dm b/code/__HELPERS/lighting.dm new file mode 100644 index 0000000000..685958b015 --- /dev/null +++ b/code/__HELPERS/lighting.dm @@ -0,0 +1,5 @@ +/// Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the [EMISSIVE_COLOR]. +/proc/emissive_appearance(icon, icon_state = "", layer = FLOAT_LAYER, alpha = 255, appearance_flags = NONE) + var/mutable_appearance/appearance = mutable_appearance(icon, icon_state, layer, EMISSIVE_PLANE, alpha, appearance_flags) + appearance.color = GLOB.emissive_color + return appearance diff --git a/code/_onclick/hud/plane_master.dm b/code/_onclick/hud/plane_master.dm index 4c736c9a2b..dcf1091264 100644 --- a/code/_onclick/hud/plane_master.dm +++ b/code/_onclick/hud/plane_master.dm @@ -127,18 +127,27 @@ mymob.overlay_fullscreen("lighting_backdrop_lit", /obj/screen/fullscreen/lighting_backdrop/lit) mymob.overlay_fullscreen("lighting_backdrop_unlit", /obj/screen/fullscreen/lighting_backdrop/unlit) -/obj/screen/plane_master/lighting/Initialize() +/*! + * This system works by exploiting BYONDs color matrix filter to use layers to handle emissive blockers. + * + * Emissive overlays are pasted with an atom color that converts them to be entirely some specific color. + * Emissive blockers are pasted with an atom color that converts them to be entirely some different color. + * Emissive overlays and emissive blockers are put onto the same plane. + * The layers for the emissive overlays and emissive blockers cause them to mask eachother similar to normal BYOND objects. + * A color matrix filter is applied to the emissive plane to mask out anything that isn't whatever the emissive color is. + * This is then used to alpha mask the lighting plane. + */ + +/atom/movable/screen/plane_master/lighting/Initialize() . = ..() - filters += filter(type="alpha", render_source = EMISSIVE_RENDER_TARGET, flags = MASK_INVERSE) - filters += filter(type="alpha", render_source = EMISSIVE_UNBLOCKABLE_RENDER_TARGET, flags = MASK_INVERSE) + add_filter("emissives", 1, alpha_mask_filter(render_source = EMISSIVE_RENDER_TARGET, flags = MASK_INVERSE)) + add_filter("object_lighting", 2, alpha_mask_filter(render_source = O_LIGHTING_VISUAL_RENDER_TARGET, flags = MASK_INVERSE)) + /** - * Things placed on this mask the lighting plane. Doesn't render directly. - * - * Gets masked by blocking plane. Use for things that you want blocked by - * mobs, items, etc. - */ -/obj/screen/plane_master/emissive + * Handles emissive overlays and emissive blockers. + */ +/atom/movable/screen/plane_master/emissive name = "emissive plane master" plane = EMISSIVE_PLANE mouse_opacity = MOUSE_OPACITY_TRANSPARENT @@ -146,36 +155,7 @@ /obj/screen/plane_master/emissive/Initialize() . = ..() - filters += filter(type="alpha", render_source=EMISSIVE_BLOCKER_RENDER_TARGET, flags=MASK_INVERSE) - filters += filter(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE) - -/** - * Things placed on this always mask the lighting plane. Doesn't render directly. - * - * Always masks the light plane, isn't blocked by anything (except Field of Vision). Use for on mob glows, - * magic stuff, etc. - */ - -/obj/screen/plane_master/emissive_unblockable - name = "unblockable emissive plane master" - plane = EMISSIVE_UNBLOCKABLE_PLANE - mouse_opacity = MOUSE_OPACITY_TRANSPARENT - render_target = EMISSIVE_UNBLOCKABLE_RENDER_TARGET - -/obj/screen/plane_master/emissive_unblockable/Initialize() - . = ..() - filters += filter(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE) - -/** - * Things placed on this layer mask the emissive layer. Doesn't render directly - * - * You really shouldn't be directly using this, use atom helpers instead - */ -/obj/screen/plane_master/emissive_blocker - name = "emissive blocker plane master" - plane = EMISSIVE_BLOCKER_PLANE - mouse_opacity = MOUSE_OPACITY_TRANSPARENT - render_target = EMISSIVE_BLOCKER_RENDER_TARGET + add_filter("em_block_masking", 1, color_matrix_filter(GLOB.em_mask_matrix)) ///Contains space parallax /obj/screen/plane_master/parallax diff --git a/code/datums/mutable_appearance.dm b/code/datums/mutable_appearance.dm index 31023b3fc7..1256286ff8 100644 --- a/code/datums/mutable_appearance.dm +++ b/code/datums/mutable_appearance.dm @@ -10,11 +10,13 @@ // And yes this does have to be in the constructor, BYOND ignores it if you set it as a normal var // Helper similar to image() -/proc/mutable_appearance(icon, icon_state = "", layer = FLOAT_LAYER, plane = FLOAT_PLANE, color = "#FFFFFF") +/proc/mutable_appearance(icon, icon_state = "", layer = FLOAT_LAYER, plane = FLOAT_PLANE, alpha = 255, appearance_flags = NONE) var/mutable_appearance/MA = new() MA.icon = icon MA.icon_state = icon_state MA.layer = layer MA.plane = plane - MA.color = color + MA.alpha = alpha + MA.appearance_flags |= appearance_flags return MA + diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 155a462295..a582419ee2 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -66,7 +66,11 @@ . = ..() switch(blocks_emissive) if(EMISSIVE_BLOCK_GENERIC) - update_emissive_block() + var/mutable_appearance/gen_emissive_blocker = mutable_appearance(icon, icon_state, plane = EMISSIVE_PLANE, alpha = src.alpha) + gen_emissive_blocker.color = GLOB.em_block_color + gen_emissive_blocker.dir = dir + gen_emissive_blocker.appearance_flags |= appearance_flags + add_overlay(list(gen_emissive_blocker)) if(EMISSIVE_BLOCK_UNIQUE) render_target = ref(src) em_block = new(src, render_target) @@ -111,13 +115,21 @@ /atom/movable/proc/update_emissive_block() if(blocks_emissive != EMISSIVE_BLOCK_GENERIC) return - if(length(managed_vis_overlays)) - for(var/a in managed_vis_overlays) - var/obj/effect/overlay/vis/vs - if(vs.plane == EMISSIVE_BLOCKER_PLANE) - SSvis_overlays.remove_vis_overlay(src, list(vs)) - break - SSvis_overlays.add_vis_overlay(src, icon, icon_state, EMISSIVE_BLOCKER_LAYER, EMISSIVE_BLOCKER_PLANE, dir) + else if (blocks_emissive == EMISSIVE_BLOCK_GENERIC) + var/mutable_appearance/gen_emissive_blocker = mutable_appearance(icon, icon_state, plane = EMISSIVE_PLANE, alpha = src.alpha) + gen_emissive_blocker.color = GLOB.em_block_color + gen_emissive_blocker.dir = dir + gen_emissive_blocker.appearance_flags |= appearance_flags + return gen_emissive_blocker + else if(blocks_emissive == EMISSIVE_BLOCK_UNIQUE) + if(!em_block) + render_target = ref(src) + em_block = new(src, render_target) + return em_block + +/atom/movable/update_overlays() + . = ..() + . += update_emissive_block() /atom/movable/proc/can_zFall(turf/source, levels = 1, turf/target, direction) if(!direction) diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index 0c628ba43e..a2d32e0d4f 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -57,8 +57,8 @@ var/overlay_state = icon_screen if(stat & BROKEN) overlay_state = "[icon_state]_broken" - SSvis_overlays.add_vis_overlay(src, icon, overlay_state, layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, overlay_state, EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha=128) + . += mutable_appearance(icon, overlay_state) + . += emissive_appearance(icon, overlay_state) /obj/machinery/computer/power_change() ..() diff --git a/code/game/machinery/computer/mechlaunchpad.dm b/code/game/machinery/computer/mechlaunchpad.dm index 3489ee5d35..86c4a35799 100644 --- a/code/game/machinery/computer/mechlaunchpad.dm +++ b/code/game/machinery/computer/mechlaunchpad.dm @@ -123,7 +123,7 @@ var/list/this_pad = list() this_pad["name"] = pad.display_name this_pad["id"] = i - if(pad.machine_stat & NOPOWER) + if(pad.stat & NOPOWER) this_pad["inactive"] = TRUE pad_list += list(this_pad) else @@ -135,7 +135,7 @@ var/obj/machinery/mechpad/current_pad = mechpads[selected_id] data["pad_name"] = current_pad.display_name data["selected_pad"] = current_pad - if(QDELETED(current_pad) || (current_pad.machine_stat & NOPOWER)) + if(QDELETED(current_pad) || (current_pad.stat & NOPOWER)) data["pad_active"] = FALSE return data data["pad_active"] = TRUE diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index c6b29cf54c..a76fbba5c7 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -78,24 +78,34 @@ . += "fire_overlay" if(is_station_level(z)) - . += "fire_[GLOB.security_level]" - SSvis_overlays.add_vis_overlay(src, icon, "fire_[GLOB.security_level]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) + . += "fire_[SSsecurity_level.current_level]" + . += mutable_appearance(icon, "fire_[SSsecurity_level.current_level]") + . += emissive_appearance(icon, "fire_[SSsecurity_level.current_level]") else . += "fire_[SEC_LEVEL_GREEN]" - SSvis_overlays.add_vis_overlay(src, icon, "fire_[SEC_LEVEL_GREEN]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) + . += mutable_appearance(icon, "fire_[SEC_LEVEL_GREEN]") + . += emissive_appearance(icon, "fire_[SEC_LEVEL_GREEN]") var/area/A = src.loc A = A.loc if(!detecting || !A.fire) . += "fire_off" - SSvis_overlays.add_vis_overlay(src, icon, "fire_off", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) + . += mutable_appearance(icon, "fire_off") + . += emissive_appearance(icon, "fire_off") else if(obj_flags & EMAGGED) . += "fire_emagged" - SSvis_overlays.add_vis_overlay(src, icon, "fire_emagged", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) + . += mutable_appearance(icon, "fire_emagged") + . += emissive_appearance(icon, "fire_emagged") else . += "fire_on" - SSvis_overlays.add_vis_overlay(src, icon, "fire_on", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) + . += mutable_appearance(icon, "fire_on") + . += emissive_appearance(icon, "fire_on") + + if(!panel_open && detecting && triggered) //It just looks horrible with the panel open + . += "fire_detected" + . += mutable_appearance(icon, "fire_detected") + . += emissive_appearance(icon, "fire_detected") //Pain /obj/machinery/firealarm/emp_act(severity) . = ..() diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 421e3433ca..40ceaf8eb9 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -26,12 +26,15 @@ /obj/machinery/light_switch/update_icon_state() if(stat & NOPOWER) - icon_state = "light-p" - else - if(on) - icon_state = "light1" - else - icon_state = "light0" + icon_state = "[base_icon_state]-p" + return ..() + icon_state = "[base_icon_state][area.lightswitch ? 1 : 0]" + return ..() + +/obj/machinery/light_switch/update_overlays() + . = ..() + if(!(stat & NOPOWER)) + . += emissive_appearance(icon, "[base_icon_state]-glow", alpha = src.alpha) /obj/machinery/light_switch/examine(mob/user) . = ..() diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index aad011119f..583b258df6 100755 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -187,16 +187,29 @@ if(B.cell) B.cell.charge = 0 +/obj/machinery/recharger/update_appearance(updates) + . = ..() + if((stat & (NOPOWER|BROKEN)) || panel_open || !anchored) + luminosity = 0 + return + luminosity = 1 -/obj/machinery/recharger/update_icon_state() +/obj/machinery/recharger/update_overlays() + . = ..() if(stat & (NOPOWER|BROKEN) || !anchored) - icon_state = "rechargeroff" - else if(panel_open) - icon_state = "rechargeropen" - else if(charging) - if(using_power) - icon_state = "recharger1" - else - icon_state = "recharger2" - else - icon_state = "recharger0" + return + if(panel_open) + . += mutable_appearance(icon, "[base_icon_state]-open", alpha = src.alpha) + return + + if(!charging) + . += mutable_appearance(icon, "[base_icon_state]-empty", alpha = src.alpha) + . += emissive_appearance(icon, "[base_icon_state]-empty", alpha = src.alpha) + return + if(using_power) + . += mutable_appearance(icon, "[base_icon_state]-charging", alpha = src.alpha) + . += emissive_appearance(icon, "[base_icon_state]-charging", alpha = src.alpha) + return + + . += mutable_appearance(icon, "[base_icon_state]-full", alpha = src.alpha) + . += emissive_appearance(icon, "[base_icon_state]-full", alpha = src.alpha) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 00c4b1f7db..32ec852b60 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -86,7 +86,7 @@ . += "off" . += "sparking" //Overlay is similar enough for both that we can use the same mask for both - SSvis_overlays.add_vis_overlay(src, icon, "locked", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) + . += emissive_appearance(icon, "locked", alpha = src.alpha) . += locked ? "locked" : "unlocked" diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index f97ef17364..6db4f9a3b4 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -59,6 +59,10 @@ else icon_state = "[initial(icon_state)]-off" +/obj/machinery/smartfridge/update_overlays() + . = ..() + if(!stat) + . += emissive_appearance(icon, "smartfridge-light-mask", alpha = src.alpha) /******************* diff --git a/code/modules/lighting/emissive_blocker.dm b/code/modules/lighting/emissive_blocker.dm index 04c1bb7302..46dc44792b 100644 --- a/code/modules/lighting/emissive_blocker.dm +++ b/code/modules/lighting/emissive_blocker.dm @@ -7,9 +7,9 @@ * almost guaranteed to be doing something wrong. */ /atom/movable/emissive_blocker - name = "" - plane = EMISSIVE_BLOCKER_PLANE - layer = EMISSIVE_BLOCKER_LAYER + name = "emissive blocker" + plane = EMISSIVE_PLANE + layer = FLOAT_LAYER mouse_opacity = MOUSE_OPACITY_TRANSPARENT rad_flags = RAD_NO_CONTAMINATE | RAD_PROTECT_CONTENTS //Why? @@ -23,6 +23,8 @@ verbs.Cut() //Cargo culting from lighting object, this maybe affects memory usage? render_source = source + color = GLOB.em_block_color + /atom/movable/emissive_blocker/ex_act(severity) return FALSE diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 9a201b7d9c..db9ce3e92d 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -275,78 +275,75 @@ // update the APC icon to show the three base states // also add overlays for indicator lights -/obj/machinery/power/apc/update_icon() - var/update = check_updates() //returns 0 if no need to update icons. - // 1 if we need to update the icon_state - // 2 if we need to update the overlays - if(!update) - icon_update_needed = FALSE +/obj/machinery/power/apc/update_appearance(updates=check_updates()) + icon_update_needed = FALSE + if(!updates) return - if(update & 1) // Updating the icon state - if(update_state & UPSTATE_ALLGOOD) - icon_state = "apc0" - else if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2)) - var/basestate = "apc[ cell ? "2" : "1" ]" - if(update_state & UPSTATE_OPENED1) - if(update_state & (UPSTATE_MAINT|UPSTATE_BROKE)) - icon_state = "apcmaint" //disabled APC cannot hold cell - else - icon_state = basestate - else if(update_state & UPSTATE_OPENED2) - if (update_state & UPSTATE_BROKE || malfhack) - icon_state = "[basestate]-b-nocover" - else - icon_state = "[basestate]-nocover" - else if(update_state & UPSTATE_BROKE) - icon_state = "apc-b" - else if(update_state & UPSTATE_BLUESCREEN) - icon_state = "apcemag" - else if(update_state & UPSTATE_WIREEXP) - icon_state = "apcewires" - else if(update_state & UPSTATE_MAINT) - icon_state = "apc0" - - if(!(update_state & UPSTATE_ALLGOOD)) - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - var/hijackerreturn - if (hijacker) - var/obj/item/implant/hijack/H = hijacker.getImplant(/obj/item/implant/hijack) - hijackerreturn = H && !H.stealthmode - if(update & 2) - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - if(!(stat & (BROKEN|MAINT)) && update_state & UPSTATE_ALLGOOD) - SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco3-[hijackerreturn ? "3" : charging]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco3-[hijackerreturn ? "3" : charging]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) - if(operating) - SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", EMISSIVE_LAYER, EMISSIVE_PLANE, dir) - + . = ..() // And now, separately for cleanness, the lighting changing - if(update_state & UPSTATE_ALLGOOD) + if(!update_state) switch(charging) if(APC_NOT_CHARGING) - light_color = LIGHT_COLOR_RED + set_light_color(COLOR_SOFT_RED) if(APC_CHARGING) - light_color = LIGHT_COLOR_BLUE + set_light_color(LIGHT_COLOR_BLUE) if(APC_FULLY_CHARGED) - light_color = LIGHT_COLOR_GREEN - if (hijackerreturn) - light_color = LIGHT_COLOR_YELLOW + set_light_color(LIGHT_COLOR_GREEN) set_light(lon_range) - else if(update_state & UPSTATE_BLUESCREEN) - light_color = LIGHT_COLOR_BLUE - set_light(lon_range) - else - set_light(0) + return - icon_update_needed = FALSE + if(update_state & UPSTATE_BLUESCREEN) + set_light_color(LIGHT_COLOR_BLUE) + set_light(lon_range) + return + + set_light(0) + +// update the APC icon to show the three base states +// also add overlays for indicator lights +/obj/machinery/power/apc/update_icon_state() + if(!update_state) + icon_state = "apc0" + return ..() + if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2)) + var/basestate = "apc[cell ? 2 : 1]" + if(update_state & UPSTATE_OPENED1) + icon_state = (update_state & (UPSTATE_MAINT|UPSTATE_BROKE)) ? "apcmaint" : basestate + else if(update_state & UPSTATE_OPENED2) + icon_state = "[basestate][((update_state & UPSTATE_BROKE) || malfhack) ? "-b" : null]-nocover" + return ..() + if(update_state & UPSTATE_BROKE) + icon_state = "apc-b" + return ..() + if(update_state & UPSTATE_BLUESCREEN) + icon_state = "apcemag" + return ..() + if(update_state & UPSTATE_WIREEXP) + icon_state = "apcewires" + return ..() + if(update_state & UPSTATE_MAINT) + icon_state = "apc0" + return ..() + +/obj/machinery/power/apc/update_overlays() + . = ..() + if((machine_stat & (BROKEN|MAINT)) || update_state) + return + + . += mutable_appearance(icon, "apcox-[locked]") + . += emissive_appearance(icon, "apcox-[locked]") + . += mutable_appearance(icon, "apco3-[charging]") + . += emissive_appearance(icon, "apco3-[charging]") + if(!operating) + return + + . += mutable_appearance(icon, "apco0-[equipment]") + . += emissive_appearance(icon, "apco0-[equipment]") + . += mutable_appearance(icon, "apco1-[lighting]") + . += emissive_appearance(icon, "apco1-[lighting]") + . += mutable_appearance(icon, "apco2-[environ]") + . += emissive_appearance(icon, "apco2-[environ]") /obj/machinery/power/apc/proc/check_updates() var/last_update_state = update_state diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index ef3a053027..57900f7098 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -401,12 +401,15 @@ //check for items in disposal - occupied light if(contents.len > 0) . += "dispover-full" + . += emissive_appearance(icon, "dispover-full", alpha = src.alpha) //charging and ready light if(pressure_charging) . += "dispover-charge" + . += emissive_appearance(icon, "dispover-charge-glow", alpha = src.alpha) else if(full_pressure) . += "dispover-ready" + . += emissive_appearance(icon, "dispover-ready-glow", alpha = src.alpha) /obj/machinery/disposal/bin/proc/do_flush() set waitfor = FALSE diff --git a/code/modules/research/nanites/nanite_program_hub.dm b/code/modules/research/nanites/nanite_program_hub.dm index db94f6548b..9a625cd0c7 100644 --- a/code/modules/research/nanites/nanite_program_hub.dm +++ b/code/modules/research/nanites/nanite_program_hub.dm @@ -31,7 +31,7 @@ if((stat & (NOPOWER|MAINT|BROKEN)) || panel_open) return . += mutable_appearance(icon, "nanite_program_hub_on") - . += mutable_appearance(icon, "nanite_program_hub_on", layer, EMISSIVE_PLANE) + . += emissive_appearance(icon, "nanite_program_hub_on") /obj/machinery/nanite_program_hub/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/disk/nanite_program)) diff --git a/code/modules/research/nanites/nanite_programmer.dm b/code/modules/research/nanites/nanite_programmer.dm index 9399e69086..d858063cb1 100644 --- a/code/modules/research/nanites/nanite_programmer.dm +++ b/code/modules/research/nanites/nanite_programmer.dm @@ -16,7 +16,7 @@ if((stat & (NOPOWER|MAINT|BROKEN)) || panel_open) return . += mutable_appearance(icon, "nanite_programmer_on") - . += mutable_appearance(icon, "nanite_programmer_on", layer, EMISSIVE_PLANE) + . += emissive_appearance(icon, "nanite_programmer_on") /obj/machinery/nanite_programmer/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/disk/nanite_program)) diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index b86ab6023a..eab1c55ca9 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -243,10 +243,8 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C . = ..() if(!light_mask) return - - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) if(!(stat & BROKEN) && powered()) - SSvis_overlays.add_vis_overlay(src, icon, light_mask, EMISSIVE_LAYER, EMISSIVE_PLANE) + . += emissive_appearance(icon, light_mask) /obj/machinery/vending/obj_break(damage_flag) . = ..() diff --git a/tgstation.dme b/tgstation.dme index 2da48b8f2f..6975143884 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -178,6 +178,7 @@ #include "code\__HELPERS\icon_smoothing.dm" #include "code\__HELPERS\icons.dm" #include "code\__HELPERS\level_traits.dm" +#include "code\__HELPERS\lighting.dm" #include "code\__HELPERS\matrices.dm" #include "code\__HELPERS\mobs.dm" #include "code\__HELPERS\mouse_control.dm"