From f1a4cf1dcf50ca023d67acee60d4f26e9409847b Mon Sep 17 00:00:00 2001 From: Markolie Date: Wed, 12 Aug 2015 22:14:47 +0200 Subject: [PATCH] SMES (de)construction fixes --- code/modules/power/smes.dm | 48 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index a116655e87e..f133dff4a16 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -150,7 +150,7 @@ return if(terminal) //is there already a terminal ? - user << "This SMES already have a power terminal!" + user << "This SMES already has a power terminal!" return if(!panel_open) //is the panel open ? @@ -162,31 +162,14 @@ user << "You must first remove the floor plating!" return - var/obj/item/stack/cable_coil/C = I if(C.amount < 10) user << "You need more wires." return - user << "You start building the power terminal..." - playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) - - if(do_after(user, 20) && C.amount >= 10) - var/obj/structure/cable/N = T.get_cable_node() //get the connecting node cable, if there's one - if (prob(50) && electrocute_mob(usr, N, N)) //animate the electrocution if uncautious and unlucky - var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread - s.set_up(5, 1, src) - s.start() - return - - C.use(10) - user.visible_message(\ - "[user.name] has built a power terminal!",\ - "You build the power terminal.") - - //build the terminal and link it to the network - make_terminal(T) - terminal.connect_to_network() + //build the terminal and link it to the network + make_terminal(user) + terminal.connect_to_network() return //disassembling the terminal @@ -196,7 +179,7 @@ user << "You must first expose the power terminal!" return - user << "You begin to dismantle the power terminal..." + user << "You begin to dismantle the power terminal..." playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) if(do_after(user, 50)) @@ -210,13 +193,20 @@ new /obj/item/stack/cable_coil(T,10) user.visible_message(\ "[user.name] cuts the cables and dismantles the power terminal.",\ - "You cut the cables and dismantle the power terminal.") + "You cut the cables and dismantle the power terminal.") inputting = 0 //stop inputting, since we have don't have a terminal anymore qdel(terminal) return //crowbarring it ! default_deconstruction_crowbar(I) + +/obj/machinery/power/smes/disconnect_terminal() + if(terminal) + terminal.master = null + terminal = null + return 1 + return 0 /obj/machinery/power/smes/Destroy() if(ticker && ticker.current_state == GAME_STATE_PLAYING) @@ -332,6 +322,18 @@ return 1 user << "You start adding cable to the [src]." if(do_after(user, 50)) + var/turf/T = get_turf(user) + var/obj/structure/cable/N = T.get_cable_node() //get the connecting node cable, if there's one + if (prob(50) && electrocute_mob(user, N, N)) //animate the electrocution if uncautious and unlucky + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() + return + + user.visible_message(\ + "[user.name] adds the cables and connects the power terminal.",\ + "You add the cables and connect the power terminal.") + terminal = new /obj/machinery/power/terminal(tempLoc) terminal.dir = tempDir terminal.master = src