lattice and grille deconstruction refactor

This commit is contained in:
Hornygranny
2014-11-07 13:36:28 -08:00
parent 5660895baf
commit c8ffcf51ae
2 changed files with 35 additions and 16 deletions
+22 -13
View File
@@ -11,6 +11,11 @@
explosion_resistance = 5
var/health = 10
var/destroyed = 0
var/obj/item/stack/rods/stored
/obj/structure/grille/New()
stored = new/obj/item/stack/rods(src)
stored.amount = 2
/obj/structure/grille/ex_act(severity)
qdel(src)
@@ -102,17 +107,27 @@
healthcheck()
return
/obj/structure/grille/Deconstruct()
transfer_fingerprints_to(stored)
var/turf/T = loc
stored.loc = T
..()
/obj/structure/grille/proc/Break()
icon_state = "brokengrille"
density = 0
destroyed = 1
stored.amount = 1
var/obj/item/stack/rods/newrods = new(loc)
transfer_fingerprints_to(newrods)
/obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob)
user.changeNext_move(CLICK_CD_MELEE)
add_fingerprint(user)
if(istype(W, /obj/item/weapon/wirecutters))
if(!shock(user, 100))
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
var/obj/item/stack/rods/newrods = new(loc)
transfer_fingerprints_to(newrods)
if(!destroyed)
newrods.amount = 2
qdel(src)
Deconstruct()
else if((istype(W, /obj/item/weapon/screwdriver)) && (istype(loc, /turf/simulated) || anchored))
if(!shock(user, 90))
playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1)
@@ -190,16 +205,10 @@
/obj/structure/grille/proc/healthcheck()
if(health <= 0)
if(!destroyed)
icon_state = "brokengrille"
density = 0
destroyed = 1
var/obj/item/stack/rods/newrods = new(loc)
transfer_fingerprints_to(newrods)
Break()
else
if(health <= -6)
qdel(src)
return
Deconstruct()
return
// shock user with probability prb (if all connections & power are working)
+13 -3
View File
@@ -6,6 +6,7 @@
density = 0
anchored = 1.0
layer = 2.3 //under pipes
var/obj/item/stack/rods/stored
// flags = CONDUCT
/obj/structure/lattice/New()
@@ -15,6 +16,7 @@
for(var/obj/structure/lattice/LAT in src.loc)
if(LAT != src)
qdel(LAT)
stored = new/obj/item/stack/rods(src)
icon = 'icons/obj/smoothlattice.dmi'
icon_state = "latticeblank"
updateOverlays()
@@ -59,8 +61,7 @@
var/obj/item/weapon/weldingtool/WT = C
if(WT.remove_fuel(0, user))
user << "<span class='notice'>Slicing lattice joints ...</span>"
new /obj/item/stack/rods(src.loc)
qdel(src)
Deconstruct()
return
/obj/structure/lattice/proc/updateOverlays()
@@ -78,4 +79,13 @@
dir_sum += direction
icon_state = "lattice[dir_sum]"
return
return
/obj/structure/lattice/Deconstruct()
var/turf/T = loc
stored.loc = T
..()
/obj/structure/lattice/singularity_pull(S, current_size)
if(current_size >= STAGE_FOUR)
Deconstruct()