mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 15:39:57 +01:00
Turned the non-functional Engineering Engine Monitor PDA app into a remote power monitor. Requires a functioning power monitor computer, if it's broken another should take over automatically if it exists or when you build one. First one to start up is the one that sends data to PDAs for now. Tested multiple power monitors at once, bombing and replacing computer. Didn't test dismantling the computer to see if that triggers the breaking code because it doesn't seem to be possible with this version of the power monitor.
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -11,6 +11,11 @@ var/global
|
||||
|
||||
defer_powernet_rebuild = 0 // true if net rebuild will be called manually after an event
|
||||
|
||||
powerreport = null //muskets 250810 these four are needed for the new engineering pda to work
|
||||
powerreportnodes = null //might be a better way to do it but w/e
|
||||
powerreportavail = null
|
||||
powerreportviewload = null
|
||||
|
||||
var
|
||||
|
||||
//////////////
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// the power monitoring computer
|
||||
// for the moment, just report the status of all APCs in the same powernet
|
||||
|
||||
|
||||
var/reportingpower = 0 //this tracks whether this power monitoring computer is the one reporting to engi PDAs - muskets
|
||||
|
||||
/obj/machinery/power/monitor/attack_ai(mob/user)
|
||||
add_fingerprint(user)
|
||||
|
||||
@@ -74,6 +77,21 @@
|
||||
if(!(stat & (NOPOWER|BROKEN)) )
|
||||
use_power(250)
|
||||
|
||||
//muskets 250810
|
||||
//this handles updating the remote power monitoring globals
|
||||
|
||||
if(!powerreport) //if no computer is updating the PDA power monitor
|
||||
reportingpower = 1 //take over updating them
|
||||
|
||||
if(reportingpower) //if this computer is updating the PDA power monitor
|
||||
if(!powernet) //if it's not connected to a powernet, don't do anything
|
||||
return
|
||||
else
|
||||
powerreport = powernet //update the globals from the current powernet - this is a bit of a hack, might need improving
|
||||
powerreportnodes = powernet.nodes
|
||||
powerreportavail = powernet.avail
|
||||
powerreportviewload = powernet.viewload
|
||||
|
||||
src.updateDialog()
|
||||
|
||||
|
||||
@@ -81,6 +99,12 @@
|
||||
|
||||
if(stat & BROKEN)
|
||||
icon_state = "broken"
|
||||
// the following four lines reset the pda power monitoring globals if the computer breaks
|
||||
// this is to stop PDAs reporting incorrect information and to allow another computer to easily take over -- muskets
|
||||
powerreport = null
|
||||
powerreportnodes = null
|
||||
powerreportavail = null
|
||||
powerreportviewload = null
|
||||
else
|
||||
if( powered() )
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
@@ -477,7 +477,7 @@
|
||||
if (!isnull(src.cartridge) && src.cartridge.access_engine)
|
||||
dat += "<h4>Engineering Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];em=1'>Engine Monitor</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];em=1'>Power Monitor</a></li>"
|
||||
dat += "</ul>"
|
||||
|
||||
if (!isnull(src.cartridge) && src.cartridge.access_medical)
|
||||
@@ -530,7 +530,39 @@
|
||||
|
||||
if (2)
|
||||
|
||||
//TO-DO: Engine monitor for whatever engine is used I guess
|
||||
//muskets 250810
|
||||
//experimental PDA power monitoring code
|
||||
//mostly ripped off from the power monitor computer
|
||||
//powerreport, powerreportnodes, powerreportavail and powerreportviewload are new globals updated by the
|
||||
//power monitor computer
|
||||
//
|
||||
//only the first power computer to come online will update, if that breaks you can build another and it'll take over
|
||||
//an existing second power monitor should take over fine too
|
||||
//see changes to /game/machinery/computer/power.dm
|
||||
if(!powerreport)
|
||||
dat += "\red No connection"
|
||||
else
|
||||
var/list/L = list()
|
||||
for(var/obj/machinery/power/terminal/term in powerreportnodes)
|
||||
if(istype(term.master, /obj/machinery/power/apc))
|
||||
var/obj/machinery/power/apc/A = term.master
|
||||
L += A
|
||||
|
||||
dat += "<PRE>Total power: [powerreportavail] W<BR>Total load: [num2text(powerreportviewload,10)] W<BR>"
|
||||
|
||||
dat += "<FONT SIZE=-1>"
|
||||
|
||||
if(L.len > 0)
|
||||
dat += "Area Eqp./Lgt./Env. Load Cell<HR>"
|
||||
|
||||
var/list/S = list(" Off","AOff"," On", " AOn")
|
||||
var/list/chg = list("N","C","F")
|
||||
|
||||
for(var/obj/machinery/power/apc/A in L)
|
||||
dat += copytext(add_tspace(A.area.name, 30), 1, 30)
|
||||
dat += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_lspace(A.lastused_total, 6)] [A.cell ? "[add_lspace(round(A.cell.percent()), 3)]% [chg[A.charging+1]]" : " N/C"]<BR>"
|
||||
|
||||
dat += "</FONT></PRE>"
|
||||
|
||||
if (3)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user