From e853b6674799eb3af15f46386402b9080ff050e1 Mon Sep 17 00:00:00 2001 From: Markolie Date: Fri, 21 Oct 2016 17:05:49 +0200 Subject: [PATCH] Minor wall deconstruction refactor --- code/game/turfs/simulated/walls.dm | 84 ++++++++----------- code/game/turfs/simulated/walls_mineral.dm | 57 +++---------- code/game/turfs/simulated/walls_misc.dm | 4 +- code/game/turfs/simulated/walls_reinforced.dm | 2 +- code/modules/mining/mine_items.dm | 1 - .../simple_animal/hostile/spaceworms.dm | 2 +- 6 files changed, 50 insertions(+), 100 deletions(-) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 45f0e42a2aa..d1fb0326466 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -3,7 +3,6 @@ desc = "A huge chunk of metal used to seperate rooms." icon = 'icons/turf/walls/wall.dmi' icon_state = "wall" - var/mineral = "metal" var/rotting = 0 var/damage = 0 @@ -22,9 +21,11 @@ thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall - var/walltype = "metal" var/hardness = 40 //lower numbers are harder. Used to determine the probability of a hulk smashing through. var/engraving, engraving_quality //engraving on the wall + + var/sheet_type = /obj/item/stack/sheet/metal + var/obj/item/stack/sheet/builtin_sheet = null canSmoothWith = list( /turf/simulated/wall, @@ -36,6 +37,10 @@ /turf/simulated/wall/r_wall/coated) smooth = SMOOTH_TRUE +/turf/simulated/wall/New() + ..() + builtin_sheet = new sheet_type + /turf/simulated/wall/BeforeChange() for(var/obj/effect/E in src) // such quality code @@ -43,8 +48,8 @@ qdel(E) . = ..() + //Appearance - /turf/simulated/wall/examine(mob/user) . = ..(user) @@ -117,46 +122,14 @@ if(radiated_temperature > max_temperature) take_damage(rand(10, 20) * (radiated_temperature / max_temperature)) -/turf/simulated/wall/proc/dismantle_wall(devastated=0, explode=0) - if(istype(src,/turf/simulated/wall/r_wall)) - if(!devastated) - playsound(src, 'sound/items/Welder.ogg', 100, 1) - new /obj/structure/girder/reinforced(src) - new /obj/item/stack/sheet/plasteel( src ) - else - new /obj/item/stack/sheet/metal( src ) - new /obj/item/stack/sheet/metal( src ) - new /obj/item/stack/sheet/plasteel( src ) - else if(istype(src,/turf/simulated/wall/cult)) - if(!devastated) - playsound(src, 'sound/items/Welder.ogg', 100, 1) - new /obj/effect/decal/cleanable/blood(src) - new /obj/structure/cultgirder(src) - else - new /obj/effect/decal/cleanable/blood(src) - new /obj/effect/decal/remains/human(src) - +/turf/simulated/wall/proc/dismantle_wall(devastated = 0, explode = 0) + if(devastated) + devastate_wall() else - if(!devastated) - playsound(src, 'sound/items/Welder.ogg', 100, 1) - new /obj/structure/girder(src) - if(mineral == "metal") - new /obj/item/stack/sheet/metal( src ) - new /obj/item/stack/sheet/metal( src ) - else - var/M = text2path("/obj/item/stack/sheet/mineral/[mineral]") - new M( src ) - new M( src ) - else - if(mineral == "metal") - new /obj/item/stack/sheet/metal( src ) - new /obj/item/stack/sheet/metal( src ) - new /obj/item/stack/sheet/metal( src ) - else - var/M = text2path("/obj/item/stack/sheet/mineral/[mineral]") - new M( src ) - new M( src ) - new /obj/item/stack/sheet/metal( src ) + playsound(src, 'sound/items/Welder.ogg', 100, 1) + var/newgirder = break_wall() + if(newgirder) //maybe we don't /want/ a girder! + transfer_fingerprints_to(newgirder) for(var/obj/O in src.contents) //Eject contents! if(istype(O,/obj/structure/sign/poster)) @@ -166,6 +139,16 @@ O.loc = src ChangeTurf(/turf/simulated/floor/plating) + +/turf/simulated/wall/proc/break_wall() + builtin_sheet.amount = 2 + builtin_sheet.loc = src + return (new /obj/structure/girder(src)) + +/turf/simulated/wall/proc/devastate_wall() + builtin_sheet.amount = 2 + builtin_sheet.loc = src + new /obj/item/stack/sheet/metal(src) /turf/simulated/wall/ex_act(severity) switch(severity) @@ -176,7 +159,7 @@ if(prob(50)) take_damage(rand(150, 250)) else - dismantle_wall(1,1) + dismantle_wall(1, 1) if(3.0) take_damage(rand(0, 250)) else @@ -216,8 +199,9 @@ O.mouse_opacity = 0 /turf/simulated/wall/proc/thermitemelt(mob/user as mob) - if(mineral == "diamond") + if(istype(sheet_type, /obj/item/stack/sheet/mineral/diamond)) return + var/obj/effect/overlay/O = new/obj/effect/overlay( src ) O.name = "Thermite" O.desc = "Looks hot." @@ -236,7 +220,6 @@ spawn(100) if(O) qdel(O) -// F.sd_LumReset() //TODO: ~Carn return //Interactions @@ -292,7 +275,8 @@ return //get the user's location - if(!istype(user.loc, /turf)) return //can't do this stuff whilst inside objects and such + if(!istype(user.loc, /turf)) + return //can't do this stuff whilst inside objects and such if(rotting) if(istype(W, /obj/item/weapon/weldingtool) ) @@ -370,7 +354,7 @@ to_chat(user, "You begin slicing through the outer plating.") playsound(src, 'sound/items/Welder.ogg', 100, 1) - if(do_after(user, mineral == "diamond" ? 120 : 60, target = src)) + if(do_after(user, istype(sheet_type, /obj/item/stack/sheet/mineral/diamond) ? 120 : 60, target = src)) to_chat(user, "You remove the outer plating.") dismantle_wall() visible_message("[user] slices apart \the [src]!","You hear metal being sliced apart.") @@ -380,7 +364,7 @@ to_chat(user, "You begin to drill though the wall.") - if(do_after(user, mineral == "diamond" ? 120 : 60, target = src)) + if(do_after(user, istype(sheet_type, /obj/item/stack/sheet/mineral/diamond) ? 120 : 60, target = src)) to_chat(user, "Your drill tears though the last of the reinforced plating.") dismantle_wall() visible_message("[user] drills through \the [src]!","You hear the grinding of metal.") @@ -389,7 +373,7 @@ to_chat(user, "You begin to disintegrates the wall.") - if(do_after(user, mineral == "diamond" ? 60 : 30, target = src)) + if(do_after(user, istype(sheet_type, /obj/item/stack/sheet/mineral/diamond) ? 60 : 30, target = src)) to_chat(user, "Your jackhammer disintegrate the reinforced plating.") dismantle_wall() visible_message("[user] disintegrates \the [src]!","You hear the grinding of metal.") @@ -401,7 +385,7 @@ to_chat(user, "You stab \the [EB] into the wall and begin to slice it apart.") playsound(src, "sparks", 50, 1) - if(do_after(user, mineral == "diamond" ? 140 : 70, target = src)) + if(do_after(user, istype(sheet_type, /obj/item/stack/sheet/mineral/diamond) ? 140 : 70, target = src)) EB.spark_system.start() playsound(src, "sparks", 50, 1) playsound(src, 'sound/weapons/blade1.ogg', 50, 1) diff --git a/code/game/turfs/simulated/walls_mineral.dm b/code/game/turfs/simulated/walls_mineral.dm index f0d5b52843f..914cb8973c8 100644 --- a/code/game/turfs/simulated/walls_mineral.dm +++ b/code/game/turfs/simulated/walls_mineral.dm @@ -12,10 +12,7 @@ desc = "A wall with gold plating. Swag!" icon = 'icons/turf/walls/gold_wall.dmi' icon_state = "gold" - walltype = "gold" - mineral = "gold" - //var/electro = 1 - //var/shocked = null + sheet_type = /obj/item/stack/sheet/mineral/gold explosion_block = 0 //gold is a soft metal you dingus. canSmoothWith = list(/turf/simulated/wall/mineral/gold, /obj/structure/falsewall/gold) @@ -24,10 +21,7 @@ desc = "A wall with silver plating. Shiny!" icon = 'icons/turf/walls/silver_wall.dmi' icon_state = "silver" - walltype = "silver" - mineral = "silver" - //var/electro = 0.75 - //var/shocked = null + sheet_type = /obj/item/stack/sheet/mineral/silver canSmoothWith = list(/turf/simulated/wall/mineral/silver, /obj/structure/falsewall/silver) /turf/simulated/wall/mineral/diamond @@ -35,8 +29,7 @@ desc = "A wall with diamond plating. You monster." icon = 'icons/turf/walls/diamond_wall.dmi' icon_state = "diamond" - walltype = "diamond" - mineral = "diamond" + sheet_type = /obj/item/stack/sheet/mineral/diamond explosion_block = 3 canSmoothWith = list(/turf/simulated/wall/mineral/diamond, /obj/structure/falsewall/diamond) @@ -45,8 +38,7 @@ desc = "A wall with bananium plating. Honk!" icon = 'icons/turf/walls/bananium_wall.dmi' icon_state = "bananium" - walltype = "bananium" - mineral = "bananium" + sheet_type = /obj/item/stack/sheet/mineral/bananium canSmoothWith = list(/turf/simulated/wall/mineral/bananium, /obj/structure/falsewall/bananium) /turf/simulated/wall/mineral/sandstone @@ -54,8 +46,7 @@ desc = "A wall with sandstone plating." icon = 'icons/turf/walls/sandstone_wall.dmi' icon_state = "sandstone" - walltype = "sandstone" - mineral = "sandstone" + sheet_type = /obj/item/stack/sheet/mineral/sandstone explosion_block = 0 canSmoothWith = list(/turf/simulated/wall/mineral/sandstone, /obj/structure/falsewall/sandstone) @@ -64,8 +55,7 @@ desc = "A wall with uranium plating. This is probably a bad idea." icon = 'icons/turf/walls/uranium_wall.dmi' icon_state = "uranium" - walltype = "uranium" - mineral = "uranium" + sheet_type = /obj/item/stack/sheet/mineral/uranium canSmoothWith = list(/turf/simulated/wall/mineral/uranium, /obj/structure/falsewall/uranium) /turf/simulated/wall/mineral/uranium/proc/radiate() @@ -98,15 +88,14 @@ desc = "A wall with plasma plating. This is definately a bad idea." icon = 'icons/turf/walls/plasma_wall.dmi' icon_state = "plasma" - walltype = "plasma" - mineral = "plasma" + sheet_type = /obj/item/stack/sheet/mineral/plasma thermal_conductivity = 0.04 canSmoothWith = list(/turf/simulated/wall/mineral/plasma, /obj/structure/falsewall/plasma) /turf/simulated/wall/mineral/plasma/attackby(obj/item/weapon/W as obj, mob/user as mob) if(is_hot(W) > 300)//If the temperature of the object is over 300, then ignite - message_admins("Plasma wall ignited by [key_name_admin(user)] in ([x],[y],[z] - JMP)",0,1) - log_game("Plasma wall ignited by [key_name(user)] in ([x],[y],[z])") + message_admins("Plasma wall ignited by [key_name_admin(user)] in ([x], [y], [z] - JMP)",0,1) + log_game("Plasma wall ignited by [key_name(user)] in ([x], [y], [z])") ignite(is_hot(W)) return ..() @@ -132,29 +121,12 @@ PlasmaBurn(500) ..() -/* -/turf/simulated/wall/mineral/proc/shock() - if(electrocute_mob(user, C, src)) - var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread - s.set_up(5, 1, src) - s.start() - return 1 - else - return 0 - -/turf/simulated/wall/mineral/proc/attackby(obj/item/weapon/W as obj, mob/user as mob, params) - if((mineral == "gold") || (mineral == "silver")) - if(shocked) - shock() -*/ - /turf/simulated/wall/mineral/alien name = "alien wall" desc = "A strange-looking alien wall." icon = 'icons/turf/walls/plasma_wall.dmi' icon_state = "plasma" - walltype = "alien" - mineral = "alien" + sheet_type = null canSmoothWith = list(/turf/simulated/wall/mineral/alien, /obj/structure/falsewall/alien) /turf/simulated/wall/mineral/wood @@ -162,8 +134,7 @@ desc = "A wall with wooden plating. Stiff." icon = 'icons/turf/walls/wood_wall.dmi' icon_state = "wood" - walltype = "wood" - mineral = "wood" + sheet_type = /obj/item/stack/sheet/wood hardness = 70 explosion_block = 0 canSmoothWith = list(/turf/simulated/wall/mineral/wood, /obj/structure/falsewall/wood) @@ -173,8 +144,7 @@ desc = "A wall with rough metal plating." icon = 'icons/turf/walls/iron_wall.dmi' icon_state = "iron" - walltype = "iron" - mineral = "rods" + sheet_type = /obj/item/stack/rods canSmoothWith = list(/turf/simulated/wall/mineral/iron, /obj/structure/falsewall/iron) /turf/simulated/wall/mineral/abductor @@ -182,7 +152,6 @@ desc = "A wall with alien alloy plating." icon = 'icons/turf/walls/abductor_wall.dmi' icon_state = "abductor" - walltype = "abductor" - mineral = "abductor" + sheet_type = /obj/item/stack/sheet/mineral/abductor explosion_block = 3 canSmoothWith = list(/turf/simulated/wall/mineral/abductor, /obj/structure/falsewall/abductor) \ No newline at end of file diff --git a/code/game/turfs/simulated/walls_misc.dm b/code/game/turfs/simulated/walls_misc.dm index 576ac6f993e..7a0abcd2d0e 100644 --- a/code/game/turfs/simulated/walls_misc.dm +++ b/code/game/turfs/simulated/walls_misc.dm @@ -3,7 +3,7 @@ desc = "The patterns engraved on the wall seem to shift as you try to focus on them. You feel sick" icon = 'icons/turf/walls/cult_wall.dmi' icon_state = "cult" - walltype = "cult" + builtin_sheet = null canSmoothWith = null /turf/simulated/wall/cult/narsie_act() @@ -14,14 +14,12 @@ desc = "A rusted metal wall." icon = 'icons/turf/walls/rusty_wall.dmi' icon_state = "arust" - walltype = "arust" /turf/simulated/wall/r_wall/rust name = "rusted reinforced wall" desc = "A huge chunk of rusted reinforced metal." icon = 'icons/turf/walls/rusty_reinforced_wall.dmi' icon_state = "rrust" - walltype = "rrust" /turf/simulated/wall/r_wall/coated //Coated for heat resistance name = "coated reinforced wall" diff --git a/code/game/turfs/simulated/walls_reinforced.dm b/code/game/turfs/simulated/walls_reinforced.dm index 7c6c750c70e..1dbda894c52 100644 --- a/code/game/turfs/simulated/walls_reinforced.dm +++ b/code/game/turfs/simulated/walls_reinforced.dm @@ -9,7 +9,7 @@ damage_cap = 200 max_temperature = 6000 hardness = 10 - walltype = "rwall" + sheet_type = /obj/item/stack/sheet/plasteel var/d_state = 0 var/can_be_reinforced = 1 diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index 1b1e4755e9b..9e4f7289532 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -344,7 +344,6 @@ desc = "An easily-compressable wall used for temporary shelter." icon = 'icons/turf/walls/survival_pod_walls.dmi' icon_state = "smooth" - walltype = "shuttle" smooth = SMOOTH_MORE // To Do: Add in Diagnaol Smooth Support canSmoothWith = list(/turf/simulated/wall/survival, /obj/machinery/door/airlock/survival_pod) diff --git a/code/modules/mob/living/simple_animal/hostile/spaceworms.dm b/code/modules/mob/living/simple_animal/hostile/spaceworms.dm index c59cdf0570a..64469bb87ef 100644 --- a/code/modules/mob/living/simple_animal/hostile/spaceworms.dm +++ b/code/modules/mob/living/simple_animal/hostile/spaceworms.dm @@ -154,7 +154,7 @@ if(istype(noms, /turf/simulated/wall)) W = noms nomDelay *= 2 - if(W.walltype == "rwall") + if(istype(W, /turf/simulated/wall/r_wall)) nomDelay *= 2 else return