From 87a3a7174b9d91bd0db4673917ace768eedebc23 Mon Sep 17 00:00:00 2001 From: zxaber <37497534+zxaber@users.noreply.github.com> Date: Mon, 20 Jul 2020 13:28:10 -0700 Subject: [PATCH] Fixes hulk arms breaking when punching non walls (#52250) * fixes an oversight with hulk recoil * locating a better solution * asdf * condenced --- code/datums/mutations/hulk.dm | 28 +++++++++++++------- code/game/turfs/closed/wall/mineral_walls.dm | 20 +++++++------- code/game/turfs/closed/wall/reinf_walls.dm | 4 +-- code/game/turfs/closed/walls.dm | 15 +++++++---- 4 files changed, 41 insertions(+), 26 deletions(-) diff --git a/code/datums/mutations/hulk.dm b/code/datums/mutations/hulk.dm index fe787928e52..b80b64b66ec 100644 --- a/code/datums/mutations/hulk.dm +++ b/code/datums/mutations/hulk.dm @@ -39,17 +39,27 @@ source.do_attack_animation(target, ATTACK_EFFECT_SMASH) source.changeNext_move(CLICK_CD_MELEE) - var/obj/item/bodypart/arm = source.hand_bodyparts[source.active_hand_index] - switch(arm.brute_dam) - if(45 to 50) - arm.force_wound_upwards(/datum/wound/brute/bone/critical) - if(41 to 45) - arm.force_wound_upwards(/datum/wound/brute/bone/severe) - if(35 to 41) - arm.force_wound_upwards(/datum/wound/brute/bone/moderate) - return COMPONENT_NO_ATTACK_HAND + +/** + *Checks damage of a hulk's arm and applies bone wounds as necessary. + * + *Called by specific atoms being attacked, such as walls. If an atom + *does not call this proc, than punching that atom will not cause + *arm breaking (even if the atom deals recoil damage to hulks). + *Arguments: + *arg1 is the arm to evaluate damage of and possibly break. + */ +/datum/mutation/human/hulk/proc/break_an_arm(obj/item/bodypart/arm) + switch(arm.brute_dam) + if(45 to 50) + arm.force_wound_upwards(/datum/wound/brute/bone/critical) + if(41 to 45) + arm.force_wound_upwards(/datum/wound/brute/bone/severe) + if(35 to 41) + arm.force_wound_upwards(/datum/wound/brute/bone/moderate) + /datum/mutation/human/hulk/on_life() if(owner.health < 0) on_losing(owner) diff --git a/code/game/turfs/closed/wall/mineral_walls.dm b/code/game/turfs/closed/wall/mineral_walls.dm index cadc35d73ee..2adb9b27b1e 100644 --- a/code/game/turfs/closed/wall/mineral_walls.dm +++ b/code/game/turfs/closed/wall/mineral_walls.dm @@ -34,8 +34,8 @@ explosion_block = 3 canSmoothWith = list(/turf/closed/wall/mineral/diamond, /obj/structure/falsewall/diamond) -/turf/closed/wall/mineral/diamond/hulk_recoil(obj/item/bodypart/arm) - arm.receive_damage(brute=41, wound_bonus = CANT_WOUND) +/turf/closed/wall/mineral/diamond/hulk_recoil(obj/item/bodypart/arm, mob/living/carbon/human/hulkman, var/damage = 41) + return ..() /turf/closed/wall/mineral/bananium name = "bananium wall" @@ -87,8 +87,8 @@ radiate() ..() -/turf/closed/wall/mineral/uranium/hulk_recoil(obj/item/bodypart/arm) - arm.receive_damage(brute=41, wound_bonus = CANT_WOUND) +/turf/closed/wall/mineral/uranium/hulk_recoil(obj/item/bodypart/arm, mob/living/carbon/human/hulkman, var/damage = 41) + return ..() /turf/closed/wall/mineral/plasma name = "plasma wall" @@ -148,8 +148,8 @@ return return ..() -/turf/closed/wall/mineral/wood/hulk_recoil(obj/item/bodypart/arm) - return //No recoil damage, wood is weak +/turf/closed/wall/mineral/hulk_recoil(obj/item/bodypart/arm, mob/living/carbon/human/hulkman, var/damage = 0) + return ..() //No recoil damage, wood is weak /turf/closed/wall/mineral/wood/nonmetal desc = "A solidly wooden wall. It's a bit weaker than a wall made with metal." @@ -179,8 +179,8 @@ bullet_sizzle = TRUE bullet_bounce_sound = null -/turf/closed/wall/mineral/snow/hulk_recoil(obj/item/bodypart/arm) - return //No recoil damage, snow is weak +/turf/closed/wall/mineral/snow/hulk_recoil(obj/item/bodypart/arm, mob/living/carbon/human/hulkman, var/damage = 0) + return ..() //No recoil damage, snow is weak /turf/closed/wall/mineral/abductor name = "alien wall" @@ -287,8 +287,8 @@ bombcore.detonate() ..() -/turf/closed/wall/mineral/plastitanium/hulk_recoil(obj/item/bodypart/arm) - arm.receive_damage(brute=41, wound_bonus = CANT_WOUND) +/turf/closed/wall/mineral/plastitanium/hulk_recoil(obj/item/bodypart/arm, mob/living/carbon/human/hulkman, var/damage = 41) + return ..() //have to copypaste this code /turf/closed/wall/mineral/plastitanium/interior/copyTurf(turf/T) diff --git a/code/game/turfs/closed/wall/reinf_walls.dm b/code/game/turfs/closed/wall/reinf_walls.dm index 892170b39ff..775860ec67d 100644 --- a/code/game/turfs/closed/wall/reinf_walls.dm +++ b/code/game/turfs/closed/wall/reinf_walls.dm @@ -47,8 +47,8 @@ playsound(src, 'sound/effects/bang.ogg', 50, TRUE) to_chat(M, "This wall is far too strong for you to destroy.") -/turf/closed/wall/r_wall/hulk_recoil(obj/item/bodypart/arm) - arm.receive_damage(brute=41, wound_bonus = CANT_WOUND) +/turf/closed/wall/r_wall/hulk_recoil(obj/item/bodypart/arm, mob/living/carbon/human/hulkman, var/damage = 41) + return ..() /turf/closed/wall/r_wall/try_decon(obj/item/W, mob/user, turf/T) //DECONSTRUCTION diff --git a/code/game/turfs/closed/walls.dm b/code/game/turfs/closed/walls.dm index bcb46f65f88..1d91f12942f 100644 --- a/code/game/turfs/closed/walls.dm +++ b/code/game/turfs/closed/walls.dm @@ -146,7 +146,7 @@ if(prob(hardness)) playsound(src, 'sound/effects/meteorimpact.ogg', 100, TRUE) user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ), forced = "hulk") - hulk_recoil(arm) + hulk_recoil(arm, user) dismantle_wall(1) else @@ -158,17 +158,22 @@ return TRUE /** - *Deals damage back to the hulk. + *Deals damage back to the hulk's arm. * *When a hulk manages to break a wall using their hulk smash, this deals back damage to the arm used. *This is in its own proc just to be easily overridden by other wall types. Default allows for three *smashed walls per arm. Also, we use CANT_WOUND here because wounds are random. Wounds are applied - *by hulk code based on arm damage and checked after an attack completes. + *by hulk code based on arm damage and checked when we call break_an_arm(). *Arguments: **arg1 is the arm to deal damage to. + **arg2 is the hulk */ -/turf/closed/wall/proc/hulk_recoil(obj/item/bodypart/arm) - arm.receive_damage(brute = 20, blocked = 0, wound_bonus = CANT_WOUND) +/turf/closed/wall/proc/hulk_recoil(obj/item/bodypart/arm, mob/living/carbon/human/hulkman, var/damage = 20) + arm.receive_damage(brute = damage, blocked = 0, wound_bonus = CANT_WOUND) + var/datum/mutation/human/hulk/smasher = locate(/datum/mutation/human/hulk) in hulkman.dna.mutations + if(!smasher || !damage) //sanity check but also snow and wood walls deal no recoil damage, so no arm breaky + return + smasher.break_an_arm(arm) /turf/closed/wall/attack_hand(mob/user) . = ..()