(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:
@@ -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)
|
||||
|
||||
@@ -231,7 +231,8 @@ namespace Barotrauma
|
||||
: afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions.Where(limbHealthFilter)));
|
||||
}
|
||||
|
||||
private LimbHealth GetMathingLimbHealth(Affliction affliction) => limbHealths[Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb).HealthIndex];
|
||||
private LimbHealth GetMatchingLimbHealth(Limb limb) => limbHealths[limb.HealthIndex];
|
||||
private LimbHealth GetMathingLimbHealth(Affliction affliction) => GetMatchingLimbHealth(Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb));
|
||||
|
||||
/// <summary>
|
||||
/// Returns the limb afflictions and non-limbspecific afflictions that are set to be displayed on this limb.
|
||||
|
||||
@@ -356,6 +356,25 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
private string roomName;
|
||||
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
|
||||
public string RoomName
|
||||
{
|
||||
get { return roomName; }
|
||||
set
|
||||
{
|
||||
if (roomName == value) { return; }
|
||||
roomName = value;
|
||||
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
|
||||
}
|
||||
}
|
||||
|
||||
public override Rectangle Rect
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user