From b4fcb9dd3254038e7b4cb2b91c23c6285aa32cfb Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 19 Aug 2020 02:39:54 +0200 Subject: [PATCH] [MIRROR] Fix runtime with CANT_WOUND weapons that use pellet_cloud (#391) * Fix runtime with CANT_WOUND weapons that use pellet_cloud (#53001) In /datum/component/pellet_cloud/proc/pellet_hit if the projectile's wound_bonus is CANT_WOUND, then wound_info_by_part[hit_part] never gets a value set. This causes an issue in /datum/component/pellet_cloud/proc/finalize() where it assumes that wound_info_by_part[hit_part] has always been set to a list(x,y,z). I added a quick if check to skip this where there's no wound info for a part. Weapon this behaviour manifested on: DRAGnet on net mode. Due to the runtime, I didn't notice it dealing any stamina damage. This should fix that scenario as well as any other CANT_WOUND projectiles and prevent them from runtiming early. * Fix runtime with CANT_WOUND weapons that use pellet_cloud Co-authored-by: Timberpoes --- code/datums/components/pellet_cloud.dm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/code/datums/components/pellet_cloud.dm b/code/datums/components/pellet_cloud.dm index 30e880a693f..326a6a6baff 100644 --- a/code/datums/components/pellet_cloud.dm +++ b/code/datums/components/pellet_cloud.dm @@ -260,13 +260,14 @@ var/obj/item/bodypart/hit_part if(isbodypart(target)) hit_part = target - target = hit_part.owner - var/damage_dealt = wound_info_by_part[hit_part][CLOUD_POSITION_DAMAGE] - var/w_bonus = wound_info_by_part[hit_part][CLOUD_POSITION_W_BONUS] - var/bw_bonus = wound_info_by_part[hit_part][CLOUD_POSITION_BW_BONUS] - var/wound_type = (initial(P.damage_type) == BRUTE) ? WOUND_BLUNT : WOUND_BURN // sharpness is handled in the wound rolling - wound_info_by_part[hit_part] = null - hit_part.painless_wound_roll(wound_type, damage_dealt, w_bonus, bw_bonus, initial(P.sharpness)) + if(wound_info_by_part[hit_part]) + target = hit_part.owner + var/damage_dealt = wound_info_by_part[hit_part][CLOUD_POSITION_DAMAGE] + var/w_bonus = wound_info_by_part[hit_part][CLOUD_POSITION_W_BONUS] + var/bw_bonus = wound_info_by_part[hit_part][CLOUD_POSITION_BW_BONUS] + var/wound_type = (initial(P.damage_type) == BRUTE) ? WOUND_BLUNT : WOUND_BURN // sharpness is handled in the wound rolling + wound_info_by_part[hit_part] = null + hit_part.painless_wound_roll(wound_type, damage_dealt, w_bonus, bw_bonus, initial(P.sharpness)) if(num_hits > 1) target.visible_message("[target] is hit by [num_hits] [proj_name]s[hit_part ? " in the [hit_part.name]" : ""]!", null, null, COMBAT_MESSAGE_RANGE, target)