From 101848f99b5850ea8a0cde53f19316ea880cb84d Mon Sep 17 00:00:00 2001 From: Lumipharon Date: Fri, 3 Nov 2023 22:18:55 +1300 Subject: [PATCH] power monitor sprite (#14331) --- code/modules/power/power_monitor.dm | 35 +++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/code/modules/power/power_monitor.dm b/code/modules/power/power_monitor.dm index 32ee86fdf82c1..9caf50aeea635 100644 --- a/code/modules/power/power_monitor.dm +++ b/code/modules/power/power_monitor.dm @@ -4,8 +4,7 @@ name = "power monitoring computer" desc = "It monitors power levels across the station." icon = 'icons/obj/machines/computer.dmi' - icon_state = "power" - + icon_state = "computer" //computer stuff density = TRUE anchored = TRUE @@ -13,6 +12,11 @@ use_power = IDLE_POWER_USE idle_power_usage = 300 active_power_usage = 300 + light_range = 1 + light_power = 0.5 + light_color = LIGHT_COLOR_EMISSIVE_YELLOW + ///screen overlay icon + var/screen_overlay = "power" /obj/machinery/power/monitor/core name = "Core Power Monitoring" @@ -28,6 +32,7 @@ attached = locate() in T if(attached) powernet = attached.powernet + update_icon() /obj/machinery/power/monitor/interact(mob/user) @@ -74,16 +79,28 @@ popup.open(FALSE) onclose(user, "powcomp") - /obj/machinery/power/monitor/update_icon() - if(machine_stat & BROKEN) - icon_state = "broken" + . = ..() + if(machine_stat & (BROKEN|DISABLED|NOPOWER)) + set_light(0) else - if(machine_stat & NOPOWER) - icon_state = "power0" - else - icon_state = initial(icon_state) + set_light(initial(light_range)) + +/obj/machinery/power/monitor/update_icon_state() + if(machine_stat & (BROKEN|DISABLED)) + icon_state = "[initial(icon_state)]_broken" + else + icon_state = initial(icon_state) + +/obj/machinery/power/monitor/update_overlays() + . = ..() + if(!screen_overlay) + return + if(machine_stat & (BROKEN|DISABLED|NOPOWER)) + return + . += emissive_appearance(icon, screen_overlay, alpha = src.alpha) + . += mutable_appearance(icon, screen_overlay, alpha = src.alpha) //copied from computer.dm /obj/machinery/power/monitor/attackby(obj/item/I, mob/user, params)