From 3b8dff83537eded72f3a6983862e19571360be70 Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:45:28 -0700 Subject: [PATCH] Handle armor points on armored rigs --- Patches/ItemPanelPatches.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Patches/ItemPanelPatches.cs b/Patches/ItemPanelPatches.cs index 3e86bf3..0605879 100644 --- a/Patches/ItemPanelPatches.cs +++ b/Patches/ItemPanelPatches.cs @@ -116,10 +116,15 @@ namespace UIFixes [PatchPrefix] 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 + ArmorComponent[] armorComponents = compareItem.GetItemComponentsInChildren(true).Where(c => c.ArmorClass > 0).ToArray(); + if (armorComponents.Any()) { - // Armor points is added in method_5, but not in other places so it's missed by compare - ArmorComponent[] armorComponents = compareItem.GetItemComponentsInChildren(true).Where(c => c.ArmorClass > 0).ToArray(); float maxDurability = armorComponents.Sum(c => c.Repairable.Durability); ItemAttributeClass itemAttributeClass = new ItemAttributeClass(EItemAttributeId.ArmorPoints);