From 4adf4fa4e92b5137adb3c2ef9c63b26d08ce0f50 Mon Sep 17 00:00:00 2001 From: Miauw Date: Fri, 4 Oct 2013 20:14:07 +0200 Subject: [PATCH] Improved APC fix: breaker can be toggled regardless of power, power can be set to off or auto when there's no power instead of only off. --- code/modules/power/apc.dm | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 1c606fff4d3..0d1ba135434 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -713,28 +713,24 @@ else if (href_list["eqp"]) var/val = text2num(href_list["eqp"]) - if(cell && cell.charge > 0) - equipment = (val==1) ? 0 : val - + equipment = setsubsystem(val) update_icon() update() else if (href_list["lgt"]) var/val = text2num(href_list["lgt"]) - if(cell && cell.charge > 0) - lighting = (val==1) ? 0 : val - + lighting = setsubsystem(val) update_icon() update() + else if (href_list["env"]) var/val = text2num(href_list["env"]) - if(cell && cell.charge > 0) - environ = (val==1) ? 0 :val - + environ = setsubsystem(val) update_icon() update() + else if( href_list["close"] ) usr << browse(null, "window=apc") usr.unset_machine() @@ -783,10 +779,8 @@ return /obj/machinery/power/apc/proc/toggle_breaker() - if(cell && cell.charge >= 0) - operating = !operating - else - operating = 0 + operating = !operating + if(malfai) if (ticker.mode.config_tag == "malfunction") if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas)) @@ -1169,4 +1163,12 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on) else return 0 +/obj/machinery/power/apc/proc/setsubsystem(val) + if(cell && cell.charge > 0) + return (val==1) ? 0 : val + else if(val == 3) + return 1 + else + return 0 + #undef APC_UPDATE_ICON_COOLDOWN \ No newline at end of file