Files
Paradise/code/game/machinery/computer/power.dm
mport2004@gmail.com 17ed3899c4 Fixed the map/code issues that the body bags caused.
/obj/effects is now /obj/effect.
/obj/station_objects is now /obj/structure.
Did a bit of minor blob work. 
The Bay 12 body bags were replaced with closets because having two sets of code that do almost the same thing is silly.
Changed back a few of the last jobproc edits as the remove from list before assign was a check to see if the mob was fucked up and if it was remove it so we did not check it again as it would still be fucked up.
The medbay/tox monkeys names are random once more.  More random name monkeys will help with changeling and clean up the observe/mob menus.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2324 316c924e-a436-60f5-8080-3fe189b3f50e
2011-10-03 10:28:57 +00:00

149 lines
4.4 KiB
Plaintext

// 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)
if(stat & (BROKEN|NOPOWER))
return
interact(user)
/obj/machinery/power/monitor/attack_hand(mob/user)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
return
interact(user)
/obj/machinery/power/monitor/attackby(I as obj, user as mob)
if(istype(I, /obj/item/weapon/screwdriver))
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
if(do_after(user, 20))
if (src.stat & BROKEN)
user << "\blue The broken glass falls out."
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
new /obj/item/weapon/shard( src.loc )
var/obj/item/weapon/circuitboard/powermonitor/M = new /obj/item/weapon/circuitboard/powermonitor( A )
for (var/obj/C in src)
C.loc = src.loc
A.circuit = M
A.state = 3
A.icon_state = "3"
A.anchored = 1
del(src)
else
user << "\blue You disconnect the monitor."
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
var/obj/item/weapon/circuitboard/powermonitor/M = new /obj/item/weapon/circuitboard/powermonitor( A )
for (var/obj/C in src)
C.loc = src.loc
A.circuit = M
A.state = 4
A.icon_state = "4"
A.anchored = 1
del(src)
else
src.attack_hand(user)
return
/obj/machinery/power/monitor/proc/interact(mob/user)
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
if (!istype(user, /mob/living/silicon))
user.machine = null
user << browse(null, "window=powcomp")
return
user.machine = src
var/t = "<TT><B>Power Monitoring</B><HR>"
t += "<BR><HR><A href='?src=\ref[src];update=1'>Refresh</A>"
t += "<BR><HR><A href='?src=\ref[src];close=1'>Close</A>"
if(!powernet)
t += "\red No connection"
else
var/list/L = list()
for(var/obj/machinery/power/terminal/term in powernet.nodes)
if(istype(term.master, /obj/machinery/power/apc))
var/obj/machinery/power/apc/A = term.master
L += A
t += "<PRE>Total power: [powernet.avail] W<BR>Total load: [num2text(powernet.viewload,10)] W<BR>"
t += "<FONT SIZE=-1>"
if(L.len > 0)
t += "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)
t += copytext(add_tspace(A.area.name, 30), 1, 30)
t += " [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>"
t += "</FONT></PRE></TT>"
user << browse(t, "window=powcomp;size=420x900")
onclose(user, "powcomp")
/obj/machinery/power/monitor/Topic(href, href_list)
..()
if( href_list["close"] )
usr << browse(null, "window=powcomp")
usr.machine = null
return
if( href_list["update"] )
src.updateDialog()
return
/obj/machinery/power/monitor/process()
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
/obj/machinery/power/monitor/power_change()
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)
stat &= ~NOPOWER
else
spawn(rand(0, 15))
src.icon_state = "c_unpowered"
stat |= NOPOWER