From db7ba7041596ca8e64279bff48b3d3f8f871fe52 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 19 Aug 2015 20:42:41 -0400 Subject: [PATCH] Adds SS13-like interface for reinforcing girders --- code/game/objects/structures/girders.dm | 155 +++++++++++++----------- html/changelogs/HarpyEagle-girders.yml | 18 +++ 2 files changed, 101 insertions(+), 72 deletions(-) create mode 100644 html/changelogs/HarpyEagle-girders.yml diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index d6c406f07e..3cc940478b 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -7,6 +7,7 @@ var/health = 200 var/cover = 50 //how much cover the girder provides against projectiles. var/material/reinf_material + var/reinforcing = 0 /obj/structure/girder/displaced icon_state = "displaced" @@ -47,6 +48,7 @@ health = min(health,initial(health)) state = 0 icon_state = initial(icon_state) + reinforcing = 0 if(reinf_material) reinforce_girder() @@ -77,13 +79,18 @@ user << "You drill through the girder!" dismantle() - else if(istype(W, /obj/item/weapon/screwdriver) && state == 2) - playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1) - user << "Now unsecuring support struts..." - if(do_after(user,40)) - if(!src) return - user << "You unsecured the support struts!" - state = 1 + else if(istype(W, /obj/item/weapon/screwdriver)) + if(state == 2) + playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1) + user << "Now unsecuring support struts..." + if(do_after(user,40)) + if(!src) return + user << "You unsecured the support struts!" + state = 1 + else if(anchored && !reinf_material) + playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1) + reinforcing = !reinforcing + user << "\The [src] can now be [reinforcing? "reinforced" : "constructed"]!" else if(istype(W, /obj/item/weapon/wirecutters) && state == 1) playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1) @@ -107,59 +114,84 @@ cover = 25 else if(istype(W, /obj/item/stack/material)) - - var/obj/item/stack/S = W - if(S.get_amount() < 2) - return ..() - - var/material/M = S.get_material() - if(!istype(M)) - return ..() - - var/wall_fake - add_hiddenprint(usr) - - if(M.integrity < 50) - user << "This material is too soft for use in wall construction." - return - - user << "You begin adding the plating..." - - if(!do_after(user,40) || !S.use(2)) - return - - if(anchored) - user << "You added the plating!" + if(reinforcing && !reinf_material) + if(!reinforce_with_material(W, user)) + return ..() else - user << "You create a false wall! Push on it to open or close the passage." - wall_fake = 1 + if(!construct_wall(W, user)) + return ..() - var/turf/Tsrc = get_turf(src) - Tsrc.ChangeTurf(/turf/simulated/wall) - var/turf/simulated/wall/T = get_turf(src) - T.set_material(M, reinf_material) - if(wall_fake) - T.can_open = 1 - T.add_hiddenprint(usr) - qdel(src) - return - - else if(istype(W, /obj/item/pipe)) - var/obj/item/pipe/P = W - if (P.pipe_type in list(0, 1, 5)) //simple pipes, simple bends, and simple manifolds. - user.drop_item() - P.loc = src.loc - user << "You fit the pipe into the [src]!" else - ..() + return ..() + +/obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user) + if(S.get_amount() < 2) + user << "There isn't enough material here to construct a wall." + return 0 + + var/material/M = name_to_material[S.default_type] + if(!istype(M)) + return 0 + + var/wall_fake + add_hiddenprint(usr) + + if(M.integrity < 50) + user << "This material is too soft for use in wall construction." + return 0 + + user << "You begin adding the plating..." + + if(!do_after(user,40) || !S.use(2)) + return 1 //once we've gotten this far don't call parent attackby() + + if(anchored) + user << "You added the plating!" + else + user << "You create a false wall! Push on it to open or close the passage." + wall_fake = 1 + + var/turf/Tsrc = get_turf(src) + Tsrc.ChangeTurf(/turf/simulated/wall) + var/turf/simulated/wall/T = get_turf(src) + T.set_material(M, reinf_material) + if(wall_fake) + T.can_open = 1 + T.add_hiddenprint(usr) + qdel(src) + return 1 + +/obj/structure/girder/proc/reinforce_with_material(obj/item/stack/material/S, mob/user) //if the verb is removed this can be renamed. + if(reinf_material) + user << "\The [src] is already reinforced." + return 0 + + if(S.get_amount() < 2) + user << "There isn't enough material here to reinforce the girder." + return 0 + + var/material/M = name_to_material[S.default_type] + if(!istype(M) || M.integrity < 50) + user << "You cannot reinforce \the [src] with that; it is too soft." + return 0 + + user << "Now reinforcing..." + if (!do_after(user,40) || !S.use(2)) + return 1 //don't call parent attackby() past this point + user << "You added reinforcement!" + + reinf_material = M + reinforce_girder() + return 1 /obj/structure/girder/proc/reinforce_girder() cover = reinf_material.hardness health = 500 state = 2 icon_state = "reinforced" + reinforcing = 0 -/obj/structure/girder/verb/reinforce_with_material() +/obj/structure/girder/verb/reinforce_with_material_verb() set name = "Reinforce girder" set desc = "Reinforce a girder with metal." set src in view(1) @@ -168,34 +200,13 @@ if(!istype(user) || !(user.l_hand || user.r_hand) || !Adjacent(user)) return - if(reinf_material) - user << "\The [src] is already reinforced." - return - var/obj/item/stack/material/S = user.l_hand if(!istype(S)) S = user.r_hand if(!istype(S)) user << "You cannot plate \the [src] with that." return - - if(S.get_amount() < 2) - user << "There is not enough material here to reinforce the girder." - return - - var/material/M = S.get_material() - if(!istype(M) || M.integrity < 50) - user << "You cannot reinforce \the [src] with that; it is too soft." - return - - user << "Now reinforcing..." - if (!do_after(user,40) || !S.use(2)) - return - user << "You added reinforcement!" - - reinf_material = M - reinforce_girder() - + reinforce_with_material(S, user) /obj/structure/girder/proc/dismantle() new /obj/item/stack/material/steel(get_turf(src)) diff --git a/html/changelogs/HarpyEagle-girders.yml b/html/changelogs/HarpyEagle-girders.yml new file mode 100644 index 0000000000..52ee2d908e --- /dev/null +++ b/html/changelogs/HarpyEagle-girders.yml @@ -0,0 +1,18 @@ +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment + +author: HarpyEagle +delete-after: True + +changes: + - tweak: "Girders can now be reinforced by using a screwdriver on the girder before applying the material sheets. Use a screwdriver again to cancel reinforcing."