From 9f4b5c6920c7445696f97e5d98281c8ae289d846 Mon Sep 17 00:00:00 2001 From: Atlantis Date: Sat, 9 Jan 2016 06:28:32 +0100 Subject: [PATCH] Power monitor tweaks - Power monitor now has modular computer header icon. - Power monitor now updates the computer's texture depending on whether there is a power network alert or not, as it used to do in the past. --- .../file_system/programs/_engineering.dm | 18 ++++++++++++++++++ code/modules/nano/modules/power_monitor.dm | 7 +++++++ nano/images/status_icons/power_norm.gif | Bin 0 -> 431 bytes nano/images/status_icons/power_warn.gif | Bin 0 -> 485 bytes 4 files changed, 25 insertions(+) create mode 100644 nano/images/status_icons/power_norm.gif create mode 100644 nano/images/status_icons/power_warn.gif diff --git a/code/modules/modular_computers/file_system/programs/_engineering.dm b/code/modules/modular_computers/file_system/programs/_engineering.dm index db00a52d90f..27ea1720457 100644 --- a/code/modules/modular_computers/file_system/programs/_engineering.dm +++ b/code/modules/modular_computers/file_system/programs/_engineering.dm @@ -6,10 +6,28 @@ nanomodule_path = /datum/nano_module/power_monitor/ program_icon_state = "power_monitor" extended_desc = "This program connects to sensors around the station to provide information about electrical systems" + ui_header = "power_norm.gif" required_access = access_engine requires_ntnet = 1 network_destination = "power monitoring system" size = 9 + var/has_alert = 0 + +/datum/computer_file/program/power_monitor/process_tick() + ..() + var/datum/nano_module/power_monitor/NMA = NM + if(istype(NMA) && NMA.has_alarm()) + if(!has_alert) + program_icon_state = "power_monitor_warn" + ui_header = "power_warn.gif" + update_computer_icon() + has_alert = 1 + else + if(has_alert) + program_icon_state = "power_monitor" + ui_header = "power_norm.gif" + update_computer_icon() + has_alert = 0 /datum/computer_file/program/alarm_monitor filename = "alarmmonitor" diff --git a/code/modules/nano/modules/power_monitor.dm b/code/modules/nano/modules/power_monitor.dm index aaae10e64ac..b0eba159e55 100644 --- a/code/modules/nano/modules/power_monitor.dm +++ b/code/modules/nano/modules/power_monitor.dm @@ -7,6 +7,13 @@ ..() refresh_sensors() +// Checks whether there is an active alarm, if yes, returns 1, otherwise returns 0. +/datum/nano_module/power_monitor/proc/has_alarm() + for(var/obj/machinery/power/sensor/S in grid_sensors) + if(S.check_grid_warning()) + return 1 + return 0 + // If PC is not null header template is loaded. Use PC.get_header_data() to get relevant nanoui data from it. All data entries begin with "PC_...." // In future it may be expanded to other modular computer devices. /datum/nano_module/power_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state) diff --git a/nano/images/status_icons/power_norm.gif b/nano/images/status_icons/power_norm.gif new file mode 100644 index 0000000000000000000000000000000000000000..2b8d60edfa50061e871e38545f613dc8775fac77 GIT binary patch literal 431 zcmZ?wbhEHb6k`x$*u=oV@B;`Le*9oKaNq!t2M3D(x&2&2f}I@$T#fV$m>Gc*ia%L6 zH5gbJbU=zg+8LNVJ$Bvsr?~GV)811_tG)|2eeYD>$-vSu>$TUecap}dW?60X(Kg8X zZxDORUFMU7Vw_-vkx?=4giDbnCG)NxE1kLa#RdURiL4|QtfqV6GX2zwDX-^!UcJa@ zoxSedcLuJ09CwyVC_c)U%u$(n)L+QW)XXYWfupNQ!M=ouhCBcc!@ou<`_u6H! zYT3F)=M2|czt#M2GoQEPwXTzM?8YT3*ZNL8y>xLR(@H08mDepETZ|_wGh#CuPq?gG zzUrmqWxwp@8ok%K=B#(;F>*TiXv2|gJ=q0IHothGGoN?$q*-@kle;^f-ZrrmVz34P Dlu)Cy literal 0 HcmV?d00001 diff --git a/nano/images/status_icons/power_warn.gif b/nano/images/status_icons/power_warn.gif new file mode 100644 index 0000000000000000000000000000000000000000..0c85b3a85a1e46e7ea81d98562f1cf10509f13d4 GIT binary patch literal 485 zcmZ?wbhEHb6k`x$*u=oV@B;`Le*9oKaNq!t2M3D(x&2&2f}I@$T#fV$m>Gc*ia%L6 zH5gbJbU=zg+8LO`Ja*mrr?~GV)812Qz2ejFDse<>RK<8qJ9lFO!-0LPH=Qzme2d$! z!Q?haTh*Hi7Wshi)kljKh4uzSyY(Ku_T|@RnU%MFKK}mNvplu%q^f7RZf?*W7f-BK z#lWnJy>!#N==SvE98BtZOF8>8eyx>dWZ>dlD;+z%n6=5OX>I#W7nOsF8=8YvD!usw zmVeOXej-@Cu6mAVXw_>A8ZTFIkYL$G`gO`34U23&g|61AV zmstl>WoP^`48OSIedNi9Dp>9EhuO9FRMM*N!cE@;ABg&?x-c+QnMJ*}n)|0UM=Ww% z@Uw0S&h*t^CF~>HKYS8&?+W?ya*oo<4Xsl;*JjN2oEj>$Y@+k?tAR&67#OSp?%csB literal 0 HcmV?d00001