Handle armor points on armored rigs
This commit is contained in:
@@ -116,10 +116,15 @@ namespace UIFixes
|
|||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
private static void Prefix(Item compareItem)
|
private static void Prefix(Item compareItem)
|
||||||
{
|
{
|
||||||
if (compareItem is ArmorClass)
|
if (compareItem == null)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Armor points is added in method_5, but not in other places so it's missed by compare
|
// Armor points is added in method_5, but not in other places so it's missed by compare
|
||||||
ArmorComponent[] armorComponents = compareItem.GetItemComponentsInChildren<ArmorComponent>(true).Where(c => c.ArmorClass > 0).ToArray<ArmorComponent>();
|
ArmorComponent[] armorComponents = compareItem.GetItemComponentsInChildren<ArmorComponent>(true).Where(c => c.ArmorClass > 0).ToArray<ArmorComponent>();
|
||||||
|
if (armorComponents.Any())
|
||||||
|
{
|
||||||
float maxDurability = armorComponents.Sum(c => c.Repairable.Durability);
|
float maxDurability = armorComponents.Sum(c => c.Repairable.Durability);
|
||||||
|
|
||||||
ItemAttributeClass itemAttributeClass = new ItemAttributeClass(EItemAttributeId.ArmorPoints);
|
ItemAttributeClass itemAttributeClass = new ItemAttributeClass(EItemAttributeId.ArmorPoints);
|
||||||
|
|||||||
Reference in New Issue
Block a user