(eaf02c38d) If the character has no mentionable afflictions, automatically select the limb with highest dmg on it (if none selected) to be displayed in the health interface.

This commit is contained in:
Joonas Rikkonen
2019-04-15 12:10:33 +03:00
parent 3b38c7e69e
commit d3481c1dd6
3 changed files with 33 additions and 3 deletions
@@ -584,11 +584,21 @@ namespace Barotrauma
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
.OrderByDescending(a => a.DamagePerSecond)
.ThenByDescending(a => a.Strength).FirstOrDefault();
var limbHealth = GetMathingLimbHealth(affliction);
if (limbHealth != null)
if (affliction.DamagePerSecond > 0 && affliction.Strength > 0)
{
var limbHealth = GetMathingLimbHealth(affliction);
if (limbHealth != null)
{
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
}
}
else
{
// If no affliction is critical, select the limb which has most damage.
var limbHealth = limbHealths.OrderByDescending(l => l.TotalDamage).FirstOrDefault();
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
}
}
LimbHealth selectedLimb = selectedLimbIndex < 0 ? highlightedLimb : limbHealths[selectedLimbIndex];
if (selectedLimb != currentDisplayedLimb || forceAfflictionContainerUpdate)