diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 54d65faa2b2..a9acc2addc2 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -1,11 +1,11 @@ -obj/structure +/obj/structure icon = 'icons/obj/structures.dmi' -obj/structure/blob_act() +/obj/structure/blob_act() if(prob(50)) qdel(src) -obj/structure/ex_act(severity) +/obj/structure/ex_act(severity) switch(severity) if(1.0) qdel(src) @@ -17,7 +17,10 @@ obj/structure/ex_act(severity) if(3.0) return -obj/structure/Destroy() +/obj/structure/Destroy() if(opacity) UpdateAffectingLights() - ..() \ No newline at end of file + ..() + +/obj/structure/proc/Deconstruct() + qdel(src) \ No newline at end of file diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 64c019aa87e..a03d6f3a8f8 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -34,6 +34,7 @@ By design, d1 is the smallest direction and d2 is the highest var/d2 = 1 // cable direction 2 (see above) layer = 2.44 //Just below unary stuff, which is at 2.45 and above pipes, which are at 2.4 var/cable_color = "red" + var/obj/item/stack/cable_coil/stored /obj/structure/cable/yellow cable_color = "yellow" @@ -81,6 +82,9 @@ By design, d1 is the smallest direction and d2 is the highest if(level==1) hide(T.intact) cable_list += src //add it to the global cable list + if(d1) + stored = new/obj/item/stack/cable_coil(src,2,cable_color) + else stored = new/obj/item/stack/cable_coil(src,1,cable_color) /obj/structure/cable/Destroy() // called when a cable is deleted if(powernet) @@ -88,6 +92,11 @@ By design, d1 is the smallest direction and d2 is the highest cable_list -= src //remove it from global cable list ..() // then go ahead and delete the cable +/obj/structure/cable/Deconstruct() + var/turf/T = loc + stored.loc = T + ..() + /////////////////////////////////// // General procedures /////////////////////////////////// @@ -120,31 +129,18 @@ By design, d1 is the smallest direction and d2 is the highest // - Multitool : get the power currently passing through the cable // /obj/structure/cable/attackby(obj/item/W, mob/user) - var/turf/T = src.loc if(T.intact) return - if(istype(W, /obj/item/weapon/wirecutters)) - if (shock(user, 50)) return - - var/obj/newcable - if(src.d1) // 0-X cables are 1 unit, X-X cables are 2 units long - newcable = new/obj/item/stack/cable_coil(T, 2, cable_color) - else - newcable = new/obj/item/stack/cable_coil(T, 1, cable_color) - visible_message("[user] cuts the cable.") - - newcable.add_fingerprint(user) + stored.add_fingerprint(user) investigate_log("was cut by [key_name(usr, usr.client)] in [user.loc.loc]","wires") - - qdel(src) + Deconstruct() return - else if(istype(W, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/coil = W if (coil.get_amount() < 1) @@ -153,13 +149,10 @@ By design, d1 is the smallest direction and d2 is the highest coil.cable_join(src, user) else if(istype(W, /obj/item/device/multitool)) - if(powernet && (powernet.avail > 0)) // is it powered? user << "[powernet.avail]W in power network." - else user << "The cable is not powered." - shock(user, 5, 0.2) else @@ -187,15 +180,17 @@ By design, d1 is the smallest direction and d2 is the highest qdel(src) if(2.0) if (prob(50)) - new/obj/item/stack/cable_coil(src.loc, src.d1 ? 2 : 1, cable_color) - qdel(src) + Deconstruct() if(3.0) if (prob(25)) - new/obj/item/stack/cable_coil(src.loc, src.d1 ? 2 : 1, cable_color) - qdel(src) + Deconstruct() return +/obj/structure/cable/singularity_pull(S, current_size) + if(current_size >= 9) + Deconstruct() + obj/structure/cable/proc/cableColor(var/colorC) var/color_n = "red" if(colorC) @@ -676,8 +671,7 @@ obj/structure/cable/proc/avail() if (C.shock(user, 50)) if (prob(50)) //fail - new/obj/item/stack/cable_coil(C.loc, 1, C.cable_color) - qdel(C) + C.Deconstruct() // called when cable_coil is click on an installed obj/cable // or click on a turf that already contains a "node" cable @@ -740,8 +734,7 @@ obj/structure/cable/proc/avail() if (NC.shock(user, 50)) if (prob(50)) //fail - new/obj/item/stack/cable_coil(NC.loc, 1, NC.cable_color) - qdel(NC) + NC.Deconstruct() return @@ -788,8 +781,7 @@ obj/structure/cable/proc/avail() if (C.shock(user, 50)) if (prob(50)) //fail - new/obj/item/stack/cable_coil(C.loc, 2, C.cable_color) - qdel(C) + C.Deconstruct() return C.denode()// this call may have disconnected some cables that terminated on the centre of the turf, if so split the powernets.