Skip to content

Commit

Permalink
Unfucks SMES construction/deconstruction (tgstation#22657)
Browse files Browse the repository at this point in the history
* Unfucks SMES construction/deconstruction

* fixes
  • Loading branch information
Core0verload authored and AnturK committed Jan 4, 2017
1 parent 50bbf5a commit 5faaa4a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions code/modules/power/smes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
var/static/list/smesImageCache


/obj/machinery/power/smes/examine(user)
..()
if(!terminal)
user << "<span class='warning'>This SMES has no power terminal!</span>"

/obj/machinery/power/smes/New()
..()
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/smes(null)
Expand Down Expand Up @@ -104,7 +109,7 @@
user << "<span class='notice'>Terminal found.</span>"
break
if(!terminal)
user << "<span class='alert'>No power source found.</span>"
user << "<span class='alert'>No power terminal found.</span>"
return
stat &= ~BROKEN
update_icon()
Expand Down Expand Up @@ -174,6 +179,15 @@
log_game("[src] has been deconstructed by [key_name(user)]")
investigate_log("SMES deconstructed by [key_name(user)]","singulo")
return
else if(panel_open && istype(I, /obj/item/weapon/crowbar))
return

return ..()

/obj/machinery/power/smes/default_deconstruction_crowbar(obj/item/weapon/crowbar/C)
if(istype(C) && terminal)
usr << "<span class='warning'>You must first remove the power terminal!</span>"
return FALSE

return ..()

Expand All @@ -197,11 +211,13 @@
terminal = new/obj/machinery/power/terminal(T)
terminal.setDir(get_dir(T,src))
terminal.master = src
stat &= ~BROKEN

/obj/machinery/power/smes/disconnect_terminal()
if(terminal)
terminal.master = null
terminal = null
stat |= BROKEN


/obj/machinery/power/smes/update_icon()
Expand Down Expand Up @@ -248,7 +264,6 @@
return round(5.5*charge/capacity)

/obj/machinery/power/smes/process()

if(stat & BROKEN)
return

Expand Down
4 changes: 2 additions & 2 deletions code/modules/power/terminal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
user << "<span class='warning'>You must first expose the power terminal!</span>"
return

if(master && master.can_terminal_dismantle())
if(!master || master.can_terminal_dismantle())
user.visible_message("[user.name] dismantles the power terminal from [master].", \
"<span class='notice'>You begin to cut the cables...</span>")

playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 50*W.toolspeed, target = src))
if(master && master.can_terminal_dismantle())
if(!master || master.can_terminal_dismantle())
if(prob(50) && electrocute_mob(user, powernet, src, 1, TRUE))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(5, 1, master)
Expand Down

0 comments on commit 5faaa4a

Please sign in to comment.