From 508bbc94e91e6572763e0f7e60819a6cc60224e0 Mon Sep 17 00:00:00 2001 From: McBawbaggings Date: Fri, 27 Jul 2018 11:06:04 +0100 Subject: [PATCH 2/4] Fixes SMES terminals and connection issues --- code/modules/power/smes.dm | 24 +++++++++++++----------- code/modules/power/terminal.dm | 3 +++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 4a8ee61f0fd..2523abde348 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -53,11 +53,11 @@ terminal = term break dir_loop - if(!terminal) - stat |= BROKEN - return - terminal.master = src - update_icon() + if(!terminal) + stat |= BROKEN + return + terminal.master = src + update_icon() /obj/machinery/power/smes/RefreshParts() var/IO = 0 @@ -141,11 +141,7 @@ //build the terminal and link it to the network make_terminal(T) terminal.connect_to_network() - return - - //disassembling the terminal - if(istype(I, /obj/item/wirecutters) && terminal && panel_open) - terminal.dismantle(user, I) + connect_to_network() return //crowbarring it ! @@ -160,6 +156,13 @@ return ..() +/obj/machinery/power/smes/wirecutter_act(mob/living/user, obj/item/I) + //disassembling the terminal + if(terminal) + terminal.dismantle(user, I) + return TRUE + + /obj/machinery/power/smes/default_deconstruction_crowbar(obj/item/crowbar/C) if(istype(C) && terminal) to_chat(usr, "You must first remove the power terminal!") @@ -192,7 +195,6 @@ /obj/machinery/power/smes/disconnect_terminal() if(terminal) terminal.master = null - terminal = null stat |= BROKEN diff --git a/code/modules/power/terminal.dm b/code/modules/power/terminal.dm index 3fa815bf998..d3b0d1d7dc1 100644 --- a/code/modules/power/terminal.dm +++ b/code/modules/power/terminal.dm @@ -71,6 +71,9 @@ new /obj/item/stack/cable_coil(drop_location(), 10) to_chat(user, "You cut the cables and dismantle the power terminal.") + var/obj/machinery/power/smes/S = master + if(istype(S, /obj/machinery/power/smes)) + S.terminal = null qdel(src) /obj/machinery/power/terminal/wirecutter_act(mob/living/user, obj/item/I) From bc7a2fcc5baa411736d31008be7fc632c82c515f Mon Sep 17 00:00:00 2001 From: McBawbaggings Date: Fri, 27 Jul 2018 12:57:32 +0100 Subject: [PATCH 3/4] panel open check and terminal nulling on disconnect --- code/modules/power/smes.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 2523abde348..aad401de2b9 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -158,7 +158,7 @@ /obj/machinery/power/smes/wirecutter_act(mob/living/user, obj/item/I) //disassembling the terminal - if(terminal) + if(terminal && panel_open) terminal.dismantle(user, I) return TRUE @@ -195,6 +195,7 @@ /obj/machinery/power/smes/disconnect_terminal() if(terminal) terminal.master = null + terminal = null stat |= BROKEN From 63e26aa95018e648e38cf118555c745a5594ac6a Mon Sep 17 00:00:00 2001 From: McBawbaggings Date: Fri, 27 Jul 2018 13:14:22 +0100 Subject: [PATCH 4/4] removes redundant code --- code/modules/power/terminal.dm | 3 --- 1 file changed, 3 deletions(-) diff --git a/code/modules/power/terminal.dm b/code/modules/power/terminal.dm index d3b0d1d7dc1..3fa815bf998 100644 --- a/code/modules/power/terminal.dm +++ b/code/modules/power/terminal.dm @@ -71,9 +71,6 @@ new /obj/item/stack/cable_coil(drop_location(), 10) to_chat(user, "You cut the cables and dismantle the power terminal.") - var/obj/machinery/power/smes/S = master - if(istype(S, /obj/machinery/power/smes)) - S.terminal = null qdel(src) /obj/machinery/power/terminal/wirecutter_act(mob/living/user, obj/item/I)