From 21faef9c11819fabe4cca8dc3e6d0f9019be1ae4 Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Fri, 24 Jan 2020 23:36:06 +0100 Subject: [PATCH] You can now damage walls and girders with weapons + misc tweaks. (#8006) You can now destroy girders and walls with powerful items. It might take some time, though, and you'll probably be better off deconstructing it unless your weapon is strong. Two-handed weapons no longer have that awkward Wielded sticking in front of the name when you wield them. Girders now report their damage status on examine. --- code/__defines/misc.dm | 2 + .../items/weapons/material/twohanded.dm | 1 - code/game/objects/structures/girders.dm | 60 ++++++++++++++----- code/game/turfs/simulated/wall_attacks.dm | 37 ++++++++++-- code/modules/mining/mine_items.dm | 1 - html/changelogs/mattatlas-wallshenanigans.yml | 43 +++++++++++++ 6 files changed, 121 insertions(+), 23 deletions(-) create mode 100644 html/changelogs/mattatlas-wallshenanigans.yml diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index f0ff7be5fe2..a30937e5ed0 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -145,6 +145,8 @@ #define WALL_CAN_OPEN 1 #define WALL_OPENING 2 +#define MIN_DAMAGE_TO_HIT 15 //Minimum damage needed to dent walls and girders by hitting them with a weapon. + #define DEFAULT_TABLE_MATERIAL "plastic" #define DEFAULT_WALL_MATERIAL "steel" diff --git a/code/game/objects/items/weapons/material/twohanded.dm b/code/game/objects/items/weapons/material/twohanded.dm index 03ad470fd46..996ca102379 100644 --- a/code/game/objects/items/weapons/material/twohanded.dm +++ b/code/game/objects/items/weapons/material/twohanded.dm @@ -41,7 +41,6 @@ /obj/item/material/twohanded/proc/wield() wielded = 1 force = force_wielded - name = "[base_name] (Wielded)" update_icon() /obj/item/material/twohanded/update_force() diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index aa56b17810e..160280b15e8 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -1,4 +1,5 @@ /obj/structure/girder + desc = "The basic building block of all walls." icon_state = "girder" anchored = 1 density = 1 @@ -10,20 +11,28 @@ var/material/reinf_material var/reinforcing = 0 +/obj/structure/girder/examine(mob/user, distance, infix, suffix) + . = ..() + var/state + var/current_damage = health / initial(health) + switch(current_damage) + if(0 to 0.2) + state = "The support struts are collapsing!" + if(0.2 to 0.4) + state = "The support struts are warped!" + if(0.4 to 0.8) + state = "The support struts are dented, but holding together." + if(0.8 to 1) + state = "The support struts look completely intact." + to_chat(user, state) + /obj/structure/girder/displaced + name = "displaced girder" icon_state = "displaced" anchored = 0 health = 50 cover = 25 -/obj/structure/girder/attack_generic(var/mob/user, var/damage, var/attack_message = "smashes apart", var/wallbreaker) - if(!damage || !wallbreaker) - return 0 - user.do_attack_animation(src) - visible_message("[user] [attack_message] the [src]!") - spawn(1) dismantle() - return 1 - /obj/structure/girder/bullet_act(var/obj/item/projectile/Proj) //Girders only provide partial cover. There's a chance that the projectiles will just pass through. (unless you are trying to shoot the girder) if(Proj.original != src && !prob(cover)) @@ -36,12 +45,15 @@ if(!istype(Proj, /obj/item/projectile/beam)) damage *= 0.4 //non beams do reduced damage - health -= damage - ..() - if(health <= 0) - dismantle() + take_damage(damage) - return + return ..() + +/obj/structure/girder/proc/take_damage(var/damage) + health -= damage + if(health <= 0) + visible_message("\The [src] falls apart!") + dismantle() /obj/structure/girder/proc/reset_girder() anchored = 1 @@ -160,8 +172,26 @@ if(!construct_wall(W, user)) return ..() - else - return ..() + else if(W.force) + var/damage_to_deal = W.force + var/weaken = 0 + if(reinf_material) + weaken += reinf_material.integrity * 2.5 //Since girders don't have a secondary material, buff 'em up a bit. + weaken /= 100 + visible_message("[user] retracts their [W] and starts winding up a strike...") + var/hit_delay = W.w_class * 10 //Heavier weapons take longer to swing, yeah? + if(do_after(user, hit_delay)) + do_attack_animation(src) + playsound(src, 'sound/weapons/smash.ogg', 50) + if(damage_to_deal > weaken && (damage_to_deal > MIN_DAMAGE_TO_HIT)) + damage_to_deal -= weaken + visible_message("[user] strikes \the [src] with \the [W], [is_sharp(W) ? "slicing" : "denting"] a support rod!") + take_damage(damage_to_deal) + else + visible_message("[user] strikes \the [src] with \the [W], but it bounces off!") + return + + return ..() /obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user) if(S.get_amount() < 2) diff --git a/code/game/turfs/simulated/wall_attacks.dm b/code/game/turfs/simulated/wall_attacks.dm index d80f6ac71e7..8feebba0239 100644 --- a/code/game/turfs/simulated/wall_attacks.dm +++ b/code/game/turfs/simulated/wall_attacks.dm @@ -102,15 +102,16 @@ return success_smash(user) return fail_smash(user, wallbreaker) -/turf/simulated/wall/attackby(obj/item/W as obj, mob/user as mob) +/turf/simulated/wall/attackby(obj/item/W, mob/user) user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) - if (!user) + if(!user) to_chat(user, "You don't have the dexterity to do this!") 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(W) radiate() @@ -118,9 +119,9 @@ burn(is_hot(W)) if(locate(/obj/effect/overlay/wallrot) in src) - if(W.iswelder() ) + if(W.iswelder()) var/obj/item/weldingtool/WT = W - if( WT.remove_fuel(0,user) ) + if(WT.remove_fuel(0,user)) to_chat(user, "You burn away the fungi with \the [WT].") playsound(src, 'sound/items/Welder.ogg', 10, 1) for(var/obj/effect/overlay/wallrot/WR in src) @@ -358,5 +359,29 @@ return else if(!istype(W,/obj/item/rfd/construction) && !istype(W, /obj/item/reagent_containers)) - return attack_hand(user) + //At this point we know that they probably wanna hit it. + if(user.a_intent != I_HURT || !W.force) + return attack_hand(user) + var/damage_to_deal = W.force + var/weaken = 0 + var/sound_to_play = 'sound/weapons/smash.ogg' + if(material) + weaken += material.integrity * 2 + sound_to_play = material.hitsound + if(reinf_material) + weaken += reinf_material.integrity * 2 + weaken /= 100 //For reference, plasteel's integrity is 600. + visible_message("[user] retracts their [W] and starts winding up a strike...") + var/hit_delay = W.w_class * 10 //Heavier weapons take longer to swing, yeah? + if(do_after(user, hit_delay)) + user.do_attack_animation(src) + playsound(src, sound_to_play, 50) + if(damage_to_deal > weaken && (damage_to_deal > MIN_DAMAGE_TO_HIT)) + //Plasteel walls take 24 & 15 minimum damage. + //Steel walls take 3 & 15 minimum damage. + damage_to_deal -= weaken + visible_message("[user] strikes \the [src] with \the [W], [is_sharp(W) ? "slicing some of the plating" : "putting a heavy dent on it"]!") + take_damage(damage_to_deal) + else + visible_message("[user] strikes \the [src] with \the [W], but it bounces off!") diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index fe40c32f666..edfad0221f1 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -88,7 +88,6 @@ wielded = 1 force = force_wielded digspeed = digspeed_wielded - name = "[name] (Wielded)" update_icon() /obj/item/pickaxe/update_icon() diff --git a/html/changelogs/mattatlas-wallshenanigans.yml b/html/changelogs/mattatlas-wallshenanigans.yml new file mode 100644 index 00000000000..05076bf0776 --- /dev/null +++ b/html/changelogs/mattatlas-wallshenanigans.yml @@ -0,0 +1,43 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# 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 +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "You can now destroy girders and walls with powerful items. It might take some time, though, and you'll probably be better off deconstructing it unless your weapon is strong." + - rscdel: "Two-handed weapons no longer have that awkward Wielded sticking in front of the name when you wield them." + - tweak: "Girders now report their damage status on examine."