From 60979828ed86e1aadcd5c99f3bc0296fb4a2db29 Mon Sep 17 00:00:00 2001 From: Logan Perkins Date: Sun, 23 Jun 2024 16:41:23 -0700 Subject: [PATCH] Only target part children by coverege if there are any --- .../CombatExtended/Verbs/Verb_MeleeAttackCE.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/CombatExtended/CombatExtended/Verbs/Verb_MeleeAttackCE.cs b/Source/CombatExtended/CombatExtended/Verbs/Verb_MeleeAttackCE.cs index c6a9591b08..1dfa44b3e9 100644 --- a/Source/CombatExtended/CombatExtended/Verbs/Verb_MeleeAttackCE.cs +++ b/Source/CombatExtended/CombatExtended/Verbs/Verb_MeleeAttackCE.cs @@ -456,7 +456,11 @@ private IEnumerable DamageInfosToApply(LocalTargetInfo target, bool if (damageInfo.HitPart != null) { - damageInfo.SetHitPart(damageInfo.HitPart.GetDirectChildParts().RandomElementByWeight(x => x.coverage)); + var children = damageInfo.HitPart.GetDirectChildParts(); + if (children.Count() > 0) + { + damageInfo.SetHitPart(children.RandomElementByWeight(x => x.coverage)); + } } } }