Sets up the the ABSTRACT flag to be used by machines and structures that should not be disassembled or break into parts.

This is specifically used by the holodeck for things that should be immune to disassembly.

Fixes invisible windoors in the holodeck.
Standardizes the fire axe's interaction with windows.
Fixes a runtime with holodeck tiles getting broken or burned.
This commit is contained in:
Vincent
2015-11-26 21:11:54 -05:00
parent e596033153
commit 026e6ee772
12 changed files with 178 additions and 217 deletions
+5 -10
View File
@@ -177,17 +177,12 @@
/obj/item/weapon/twohanded/fireaxe/afterattack(atom/A as mob|obj|turf|area, mob/user, proximity)
if(!proximity) return
if(A && wielded && (istype(A,/obj/structure/window) || istype(A,/obj/structure/grille))) //destroys windows and grilles in one hit
if(istype(A,/obj/structure/window)) //should just make a window.Break() proc but couldn't bother with it
if(wielded) //destroys windows and grilles in one hit
if(istype(A,/obj/structure/window))
var/obj/structure/window/W = A
new /obj/item/weapon/shard( W.loc )
if(W.reinf) new /obj/item/stack/rods( W.loc)
if (W.dir == SOUTHWEST)
new /obj/item/weapon/shard( W.loc )
if(W.reinf) new /obj/item/stack/rods( W.loc)
qdel(A)
W.spawnfragments() // this will qdel and spawn shards
else if(istype(A,/obj/structure/grille))
qdel(A)
/*
@@ -58,7 +58,7 @@
qdel(src)
/obj/structure/bed/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/wrench))
if(istype(W, /obj/item/weapon/wrench) && !(flags&ABSTRACT))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
if(buildstacktype)
new buildstacktype(loc, buildstackamount)
@@ -165,7 +165,8 @@
/obj/structure/closet/ex_act(severity, target)
contents_explosion(severity, target)
new material_drop(loc)
if(loc && ispath(material_drop) && !(flags & ABSTRACT))
new material_drop(loc)
dump_contents()
qdel(src)
..()
+21 -20
View File
@@ -147,26 +147,26 @@
if (istype(I, /obj/item/weapon/grab))
tablepush(I, user)
return
if (istype(I, /obj/item/weapon/screwdriver))
if(istype(src, /obj/structure/table/reinforced))
var/obj/structure/table/reinforced/RT = src
if(RT.status == 1)
if(!(flags&ABSTRACT))
if (istype(I, /obj/item/weapon/screwdriver))
if(istype(src, /obj/structure/table/reinforced))
var/obj/structure/table/reinforced/RT = src
if(RT.status == 1)
table_destroy(2, user)
return
else
table_destroy(2, user)
return
else
table_destroy(2, user)
return
if (istype(I, /obj/item/weapon/wrench))
if(istype(src, /obj/structure/table/reinforced))
var/obj/structure/table/reinforced/RT = src
if(RT.status == 1)
if (istype(I, /obj/item/weapon/wrench))
if(istype(src, /obj/structure/table/reinforced))
var/obj/structure/table/reinforced/RT = src
if(RT.status == 1)
table_destroy(3, user)
return
else
table_destroy(3, user)
return
else
table_destroy(3, user)
return
if (istype(I, /obj/item/weapon/storage/bag/tray))
var/obj/item/weapon/storage/bag/tray/T = I
@@ -205,7 +205,7 @@
#define TBL_DECONSTRUCT 3
/obj/structure/table/proc/table_destroy(destroy_type, mob/user)
if(!deconstructable)
if(!deconstructable || (flags&ABSTRACT))
return
if(destroy_type == TBL_DESTROY)
@@ -462,7 +462,7 @@
return
/obj/structure/rack/attackby(obj/item/weapon/W, mob/user, params)
if (istype(W, /obj/item/weapon/wrench))
if (istype(W, /obj/item/weapon/wrench) && !(flags&ABSTRACT))
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
rack_destroy()
return
@@ -517,9 +517,10 @@
*/
/obj/structure/rack/proc/rack_destroy()
density = 0
var/obj/item/weapon/rack_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
if(!(flags&ABSTRACT))
density = 0
var/obj/item/weapon/rack_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
qdel(src)
+63 -59
View File
@@ -30,17 +30,20 @@
health = maxhealth
if(re)
reinf = re
storeditems.Add(new/obj/item/weapon/shard(src))
if(fulltile)
storeditems.Add(new/obj/item/weapon/shard(src))
ini_dir = dir
if(reinf)
state = 2*anchored
var/obj/item/stack/rods/R = new/obj/item/stack/rods(src)
storeditems.Add(R)
if(fulltile)
R.add(1)
if(!(flags & ABSTRACT))
storeditems.Add(new/obj/item/weapon/shard(src))
if(fulltile)
storeditems.Add(new/obj/item/weapon/shard(src))
if(reinf)
var/obj/item/stack/rods/R = new/obj/item/stack/rods(src)
storeditems.Add(R)
if(fulltile)
R.add(1)
ini_dir = dir
air_update_turf(1)
return
@@ -191,38 +194,8 @@
return 1 //skip the afterattack
add_fingerprint(user)
if(istype(I, /obj/item/weapon/screwdriver))
playsound(loc, 'sound/items/Screwdriver.ogg', 75, 1)
if(reinf && (state == 2 || state == 1))
user << (state == 2 ? "<span class='notice'>You begin to unscrew the window from the frame...</span>" : "<span class='notice'>You begin to screw the window to the frame...</span>")
else if(reinf && state == 0)
user << (anchored ? "<span class='notice'>You begin to unscrew the frame from the floor...</span>" : "<span class='notice'>You begin to screw the frame to the floor...</span>")
else if(!reinf)
user << (anchored ? "<span class='notice'>You begin to unscrew the window from the floor...</span>" : "<span class='notice'>You begin to screw the window to the floor...</span>")
if(do_after(user, 40, target = src))
if(reinf && (state == 1 || state == 2))
//If state was unfastened, fasten it, else do the reverse
state = (state == 1 ? 2 : 1)
user << (state == 1 ? "<span class='notice'>You unfasten the window from the frame.</span>" : "<span class='notice'>You fasten the window to the frame.</span>")
else if(reinf && state == 0)
anchored = !anchored
update_nearby_icons()
user << (anchored ? "<span class='notice'>You fasten the frame to the floor.</span>" : "<span class='notice'>You unfasten the frame from the floor.</span>")
else if(!reinf)
anchored = !anchored
update_nearby_icons()
user << (anchored ? "<span class='notice'>You fasten the window to the floor.</span>" : "<span class='notice'>You unfasten the window.</span>")
else if (istype(I, /obj/item/weapon/crowbar) && reinf && (state == 0 || state == 1))
user << (state == 0 ? "<span class='notice'>You begin to lever the window into the frame...</span>" : "<span class='notice'>You begin to lever the window out of the frame...</span>")
playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
if(do_after(user, 40, target = src))
//If state was out of frame, put into frame, else do the reverse
state = (state == 0 ? 1 : 0)
user << (state == 1 ? "<span class='notice'>You pry the window into the frame.</span>" : "<span class='notice'>You pry the window out of the frame.</span>")
else if(istype(I, /obj/item/weapon/weldingtool) && user.a_intent == "help")
if(istype(I, /obj/item/weapon/weldingtool) && user.a_intent == "help")
var/obj/item/weapon/weldingtool/WT = I
if(health < maxhealth)
if(WT.remove_fuel(0,user))
@@ -235,32 +208,63 @@
user << "<span class='warning'>[src] is already in good condition!</span>"
return
update_nearby_icons()
else if(!(flags&ABSTRACT))
if(istype(I, /obj/item/weapon/screwdriver))
playsound(loc, 'sound/items/Screwdriver.ogg', 75, 1)
if(reinf && (state == 2 || state == 1))
user << (state == 2 ? "<span class='notice'>You begin to unscrew the window from the frame...</span>" : "<span class='notice'>You begin to screw the window to the frame...</span>")
else if(reinf && state == 0)
user << (anchored ? "<span class='notice'>You begin to unscrew the frame from the floor...</span>" : "<span class='notice'>You begin to screw the frame to the floor...</span>")
else if(!reinf)
user << (anchored ? "<span class='notice'>You begin to unscrew the window from the floor...</span>" : "<span class='notice'>You begin to screw the window to the floor...</span>")
else if(istype(I, /obj/item/weapon/wrench) && !anchored)
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
user << "<span class='notice'> You begin to disassemble [src]...</span>"
if(do_after(user, 40, target = src))
if(disassembled)
return //Prevents multiple deconstruction attempts
if(do_after(user, 40, target = src))
if(reinf && (state == 1 || state == 2))
//If state was unfastened, fasten it, else do the reverse
state = (state == 1 ? 2 : 1)
user << (state == 1 ? "<span class='notice'>You unfasten the window from the frame.</span>" : "<span class='notice'>You fasten the window to the frame.</span>")
else if(reinf && state == 0)
anchored = !anchored
update_nearby_icons()
user << (anchored ? "<span class='notice'>You fasten the frame to the floor.</span>" : "<span class='notice'>You unfasten the frame from the floor.</span>")
else if(!reinf)
anchored = !anchored
update_nearby_icons()
user << (anchored ? "<span class='notice'>You fasten the window to the floor.</span>" : "<span class='notice'>You unfasten the window.</span>")
if(reinf)
var/obj/item/stack/sheet/rglass/RG = new (user.loc)
RG.add_fingerprint(user)
if(fulltile) //fulltiles drop two panes
RG = new (user.loc)
else if (istype(I, /obj/item/weapon/crowbar) && reinf && (state == 0 || state == 1))
user << (state == 0 ? "<span class='notice'>You begin to lever the window into the frame...</span>" : "<span class='notice'>You begin to lever the window out of the frame...</span>")
playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
if(do_after(user, 40, target = src))
//If state was out of frame, put into frame, else do the reverse
state = (state == 0 ? 1 : 0)
user << (state == 1 ? "<span class='notice'>You pry the window into the frame.</span>" : "<span class='notice'>You pry the window out of the frame.</span>")
else if(istype(I, /obj/item/weapon/wrench) && !anchored)
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
user << "<span class='notice'> You begin to disassemble [src]...</span>"
if(do_after(user, 40, target = src))
if(disassembled)
return //Prevents multiple deconstruction attempts
if(reinf)
var/obj/item/stack/sheet/rglass/RG = new (user.loc)
RG.add_fingerprint(user)
if(fulltile) //fulltiles drop two panes
RG = new (user.loc)
RG.add_fingerprint(user)
else
var/obj/item/stack/sheet/glass/G = new (user.loc)
G.add_fingerprint(user)
if(fulltile)
G = new (user.loc)
else
var/obj/item/stack/sheet/glass/G = new (user.loc)
G.add_fingerprint(user)
if(fulltile)
G = new (user.loc)
G.add_fingerprint(user)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
disassembled = 1
user << "<span class='notice'>You successfully disassemble [src].</span>"
qdel(src)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
disassembled = 1
user << "<span class='notice'>You successfully disassemble [src].</span>"
qdel(src)
else if(istype(I, /obj/item/weapon/rcd)) //Do not attack the window if the user is holding an RCD
return