Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Walls now save their girder material when built #14501

Merged
merged 16 commits into from Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 11 additions & 12 deletions code/obj/false_wall.dm
Expand Up @@ -116,6 +116,14 @@ ADMIN_INTERACT_PROCS(/turf/simulated/wall/false_wall, proc/open, proc/close)
boutput(user, "<span class='notice'>It was a false wall!</span>")
//disassemble it
boutput(user, "<span class='notice'>Now dismantling false wall.</span>")

//a false wall turns into a sheet of metal and displaced girders
var/atom/A = new /obj/item/sheet(src)
var/atom/B = new /obj/structure/girder/displaced(src)
var/datum/material/defaultMaterial = getMaterial("steel")
A.setMaterial(src.material ? src.material : defaultMaterial, copy = FALSE)
B.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)

var/floorname1 = src.floorname
var/floorintact1 = src.floorintact
var/floorburnt1 = src.floorburnt
Expand All @@ -132,16 +140,7 @@ ADMIN_INTERACT_PROCS(/turf/simulated/wall/false_wall, proc/open, proc/close)
F.icon_state = flooricon_state1
F.setIntact(floorintact1)
F.burnt = floorburnt1
//a false wall turns into a sheet of metal and displaced girders
var/atom/A = new /obj/item/sheet(F)
var/atom/B = new /obj/structure/girder/displaced(F)
if(src.material)
A.setMaterial(src.material)
B.setMaterial(src.material)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M)
B.setMaterial(M)

F.levelupdate()
logTheThing(LOG_STATION, user, "dismantles a False Wall in [user.loc.loc] ([log_loc(user)])")
return
Expand All @@ -160,7 +159,7 @@ ADMIN_INTERACT_PROCS(/turf/simulated/wall/false_wall, proc/open, proc/close)
if (src.operating)
return 0
src.operating = 1
src.name = "false wall"
src.name = src.material ? "false [src.material.name] wall" : "false wall"
animate(src, time = delay, pixel_x = 25, easing = BACK_EASING)
SPAWN(delay)
//we want to return 1 without waiting for the animation to finish - the textual cue seems sloppy if it waits
Expand All @@ -182,7 +181,7 @@ ADMIN_INTERACT_PROCS(/turf/simulated/wall/false_wall, proc/open, proc/close)
if (src.operating)
return 0
src.operating = 1
src.name = "wall"
src.name = src.material ? "[src.material.name] wall" : "steel wall"
animate(src, time = delay, pixel_x = 0, easing = BACK_EASING)
src.set_density(1)
src.gas_impermeable = 1
Expand Down
52 changes: 27 additions & 25 deletions code/obj/structure.dm
Expand Up @@ -73,17 +73,17 @@ obj/structure/ex_act(severity)
if (src.material)
A.setMaterial(src.material)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M)
var/datum/material/defaultMaterial = getMaterial("steel")
A.setMaterial(defaultMaterial)
qdel(src)
else
if (prob(30))
var/atom/A = new /obj/structure/girder/displaced(src)
if (src.material)
A.setMaterial(src.material)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M)
var/datum/material/defaultMaterial = getMaterial("steel")
A.setMaterial(defaultMaterial)
else
qdel(src)

Expand Down Expand Up @@ -118,10 +118,15 @@ obj/structure/ex_act(severity)
return

if (src.icon_state != "reinforced" && S.reinforcement)
actions.start(new /datum/action/bar/icon/girder_tool_interact(src, W, GIRDER_REINFORCE, null, user), user)

if (S.material.material_flags & MATERIAL_METAL)
actions.start(new /datum/action/bar/icon/girder_tool_interact(src, W, GIRDER_REINFORCE, null, user), user)
else
boutput(user, "You cannot reinforce [src] with [S]!")
else
actions.start(new /datum/action/bar/icon/girder_tool_interact(src, W, GIRDER_PLATE, null, user), user)
if (S.material.material_flags & MATERIAL_METAL)
actions.start(new /datum/action/bar/icon/girder_tool_interact(src, W, GIRDER_PLATE, null, user), user)
else
boutput(user, "You cannot plate [src] with [S]!")
else
..()

Expand Down Expand Up @@ -211,8 +216,8 @@ obj/structure/ex_act(severity)
if (the_girder.material)
A.setMaterial(the_girder.material)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M)
var/datum/material/defaultMaterial = getMaterial("steel")
A.setMaterial(defaultMaterial)
qdel(the_girder)
if (GIRDER_UNSECURESUPPORT)
verbens = "unsecured the support struts of"
Expand All @@ -233,8 +238,8 @@ obj/structure/ex_act(severity)
if (the_tool.material)
A.setMaterial(the_girder.material)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M)
var/datum/material/defaultMaterial = getMaterial("steel")
A.setMaterial(defaultMaterial)
qdel(the_girder)
if (GIRDER_SECURE)
if (!istype(the_girder.loc, /turf/simulated/floor/))
Expand All @@ -250,15 +255,15 @@ obj/structure/ex_act(severity)
var/turf/Tsrc = get_turf(the_girder)
var/turf/simulated/wall/WALL
var/obj/item/sheet/S = the_tool
var/datum/material/defaultMaterial = getMaterial("steel")

if (S.reinforcement)
WALL = Tsrc.ReplaceWithRWall()
else
WALL = Tsrc.ReplaceWithWall()
if (the_girder.material)
WALL.setMaterial(the_girder.material)
else
var/datum/material/M = getMaterial("steel")
WALL.setMaterial(M)
WALL.setMaterial(S.material ? S.material : defaultMaterial)
WALL.girdermaterial = the_girder.material ? the_girder.material : defaultMaterial

WALL.inherit_area()
S?.change_stack_amount(-2)

Expand Down Expand Up @@ -299,19 +304,16 @@ obj/structure/ex_act(severity)
var/FloorIntact = T.intact
var/FloorBurnt = T.burnt
var/FloorName = T.name
var/oldmat = src.material

var/target_type = S.reinforcement ? /turf/simulated/wall/false_wall/reinforced : /turf/simulated/wall/false_wall

T.ReplaceWith(target_type, FALSE, FALSE, FALSE)
var/atom/A = src.loc
if(oldmat)
A.setMaterial(oldmat)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M)

var/datum/material/defaultMaterial = getMaterial("steel")
var/turf/simulated/wall/false_wall/FW = A

FW.setMaterial(S.material ? S.material : defaultMaterial, copy = FALSE)
FW.girdermaterial = src.material ? src.material : defaultMaterial
FW.inherit_area()

FW.setFloorUnderlay(FloorIcon, FloorState, FloorIntact, 0, FloorBurnt, FloorName)
Expand All @@ -327,8 +329,8 @@ obj/structure/ex_act(severity)
if(src.material)
S.setMaterial(src.material)
else
var/datum/material/M = getMaterial("steel")
S.setMaterial(M)
var/datum/material/defaultMaterial = getMaterial("steel")
S.setMaterial(defaultMaterial)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 75, 1)
qdel(src)
return
Expand Down
65 changes: 23 additions & 42 deletions code/turf/walls.dm
Expand Up @@ -18,6 +18,7 @@
var/health = 100
var/list/forensic_impacts = null
var/last_proj_update_time = null
var/girdermaterial = null

New()
..()
Expand Down Expand Up @@ -131,86 +132,65 @@
qdel(parts)

/turf/simulated/wall/proc/dismantle_wall(devastated=0, keep_material = 1)
var/datum/material/defaultMaterial = getMaterial("steel")
if (istype(src, /turf/simulated/wall/r_wall) || istype(src, /turf/simulated/wall/auto/reinforced))
if (!devastated)
var/atom/A = new /obj/structure/girder/reinforced(src)
var/obj/item/sheet/B = new /obj/item/sheet( src )
if (src.material)
A.setMaterial(src.material)
B.setMaterial(src.material)
B.set_reinforcement(src.material)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M, copy = FALSE)
B.setMaterial(M, copy = FALSE)
B.set_reinforcement(M)

A.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)
B.setMaterial(src.material ? src.material : defaultMaterial, copy = FALSE)
B.set_reinforcement(src.material)
else
if (prob(50)) // pardon all these nested probabilities, just trying to vary the damage appearance a bit
var/atom/A = new /obj/structure/girder/reinforced(src)
if (src.material)
A.setMaterial(src.material)
else
A.setMaterial(getMaterial("steel"), copy = FALSE)
A.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)


if (prob(50))
var/atom/movable/B = new /obj/item/raw_material/scrap_metal
B.set_loc(src)
if (src.material)
B.setMaterial(src.material)
else
B.setMaterial(getMaterial("steel"), copy = FALSE)
B.setMaterial(src.material ? src.material : defaultMaterial, copy = FALSE)

else if( prob(50))
var/atom/A = new /obj/structure/girder(src)
if (src.material)
A.setMaterial(src.material)
else
A.setMaterial(getMaterial("steel"), copy = FALSE)
A.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)

else
if (!devastated)
var/atom/A = new /obj/structure/girder(src)
var/atom/B = new /obj/item/sheet( src )
var/atom/C = new /obj/item/sheet( src )
if (src.material)
A.setMaterial(src.material)
B.setMaterial(src.material)
C.setMaterial(src.material)
else
var/datum/material/M = getMaterial("steel")
A.setMaterial(M, copy = FALSE)
B.setMaterial(M, copy = FALSE)
C.setMaterial(M, copy = FALSE)

A.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)
B.setMaterial(src.material ? src.material : defaultMaterial, copy = FALSE)
C.setMaterial(src.material ? src.material : defaultMaterial, copy = FALSE)
monkeymilesmoo marked this conversation as resolved.
Show resolved Hide resolved

else
if (prob(50))
var/atom/A = new /obj/structure/girder/displaced(src)
if (src.material)
A.setMaterial(src.material)
else
A.setMaterial(getMaterial("steel"), copy = FALSE)
A.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)


else if (prob(50))
var/atom/B = new /obj/structure/girder(src)

if (src.material)
B.setMaterial(src.material)
else
B.setMaterial(getMaterial("steel"), copy = FALSE)
B.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)


if (prob(50))
var/atom/movable/C = new /obj/item/raw_material/scrap_metal
C.set_loc(src)
if (src.material)
C.setMaterial(src.material)
else
C.setMaterial(getMaterial("steel"), copy = FALSE)
C.setMaterial(src.girdermaterial ? src.girdermaterial : defaultMaterial, copy = FALSE)


var/atom/D = ReplaceWithFloor()
if (src.material && keep_material)
D.setMaterial(src.material)
else
D.setMaterial(getMaterial("steel"), copy = FALSE)


/turf/simulated/wall/burn_down()
src.ReplaceWithFloor()

Expand Down Expand Up @@ -334,6 +314,7 @@
health *= 0.75
if(src.material.material_flags & MATERIAL_CRYSTAL)
health /= 2
desc += " Wait where did the girder go?"
return

/turf/simulated/wall/r_wall/attackby(obj/item/W, mob/user, params)
Expand Down