diff --git a/main-src/Code/Machinery/Power/apc.dm b/main-src/Code/Machinery/Power/apc.dm
index 523480d..f939a49 100644
--- a/main-src/Code/Machinery/Power/apc.dm
+++ b/main-src/Code/Machinery/Power/apc.dm
@@ -342,6 +342,8 @@ obj/machinery/power/apc
area.power_light = 0
area.power_equip = 0
area.power_environ = 0
+ chargecount = 0 // H9.6 FIX: If breaker is off, stop charging
+ charging = 0
area.power_change()
diff --git a/main-src/Code/Machinery/Power/monitor.dm b/main-src/Code/Machinery/Power/monitor.dm
index a9b98c3..d2a4c8f 100644
--- a/main-src/Code/Machinery/Power/monitor.dm
+++ b/main-src/Code/Machinery/Power/monitor.dm
@@ -1,7 +1,7 @@
/*
* Power Monitor - reports the available power, load, and status of APCs on the same power network.
*
- * TODO: Make the power monitor also able to remote-control APCs (with sufficient ID access) to shut down things remotely.
+ * Also allows (limited) remote control of APCs on same network
*/
obj/machinery/power/monitor
@@ -10,6 +10,10 @@ obj/machinery/power/monitor
icon_state = "power_computer"
density = 1
anchored = 1
+ var
+ control = 0 // true if remote APC control is enabled
+ access = "4000/2030/3004" // ID card access levels needed to enable remote control
+ allowed = "Systems" // ID card job assignment needed to enable remote control
// Attack with hand, show report window
@@ -22,6 +26,23 @@ obj/machinery/power/monitor
interact(user)
+ // Attack with item
+ // If ID card, check access and enable/disable remote APC control
+
+ attackby(obj/item/weapon/W, mob/user)
+ if(stat & (BROKEN|NOPOWER))
+ return
+ if (istype(W, /obj/item/weapon/card/id) ) // trying to toggle remote control with an ID card
+
+ var/obj/item/weapon/card/id/I = W
+ if (I.check_access(access, allowed))
+ control = !control
+ user << "You [ control ? "enable" : "disable"] remote APC control."
+ else
+ user << "\red Access denied."
+ else
+ attack_hand(user) // otherwise interact as usual
+
// Show the interaction window to the user
proc/interact(mob/user)
@@ -52,7 +73,12 @@ obj/machinery/power/monitor
if(L.len > 0)
- t += "Area Eqp./Lgt./Env. Load Cell
"
+ if(control)
+ t += "(Swipe ID card to disable remote control.)
"
+ else
+ t += "(Swipe ID card to enable remote control.)
"
+
+ t += "Area Brkr./Eqp./Lgt./Env. Load Cell
"
var/list/S = list(" Off","AOff"," On", " AOn")
var/list/chg = list("N","C","F")
@@ -60,23 +86,47 @@ obj/machinery/power/monitor
for(var/obj/machinery/power/apc/A in L)
t += copytext(add_tspace(A.area.name, 30), 1, 30)
+ if(control)
+ t += " ([A.operating? " On" : "Off"])"
+ else
+ t += " ([A.operating? "On " : "Off"])"
+
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"]
"
t += ""
t += "
Close"
- user << browse(t, "window=powcomp;size=420x700")
+ user << browse(t, "window=powcomp;size=450x740")
- // Handle topic links from the interaction window (close only at the moment)
+ // Handle topic links from the interaction window
Topic(href, href_list)
..()
- if( href_list["close"] )
+ if (usr.stat || usr.restrained() )
+ return
+ if ((!( istype(usr, /mob/human) ) && (!( ticker ) || (ticker && ticker.mode != "monkey"))))
+ usr << "\red You don't have the dexterity to do this!"
+ return
+
+ if (( (get_dist(src, usr) <= 1 && istype(src.loc, /turf))))
+ usr.machine = src
+ if (href_list["breaker"])
+ var/obj/machinery/power/apc/APC = locate(href_list["apc"])
+ APC.operating = !APC.operating
+ APC.update()
+ APC.updateicon()
+ for(var/mob/M in viewers(1, src))
+ if ((M.client && M.machine == src))
+ src.interact(M)
+ else if( href_list["close"] )
+ usr << browse(null, "window=powcomp")
+ usr.machine = null
+ return
+ else
usr << browse(null, "window=powcomp")
usr.machine = null
- return
// Timed process - use power, update window to viewers
diff --git a/main-src/Code/globals.dm b/main-src/Code/globals.dm
index 55a9c3c..40ee5a8 100644
--- a/main-src/Code/globals.dm
+++ b/main-src/Code/globals.dm
@@ -3,17 +3,8 @@
Contining reorg of obj/machinery code
Changed how solar panel directions are displayed, to fix the rotation display bug.
-
-
-
-
-
-
-
-
-
-
-
+ Added remote APC control the power_monitor
+ Fixed a bug where APCs would continue to draw power for cell charging even when the breaker was off.