Skip to content

Commit

Permalink
power monitor sprite (#14331)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumipharon authored Nov 3, 2023
1 parent 9309a5f commit 101848f
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions code/modules/power/power_monitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
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
circuit = /obj/item/circuitboard/computer/powermonitor
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"
Expand All @@ -28,6 +32,7 @@
attached = locate() in T
if(attached)
powernet = attached.powernet
update_icon()


/obj/machinery/power/monitor/interact(mob/user)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 101848f

Please sign in to comment.