diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 6994eb2fe..ddfda4c06 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Assets/Scripts/UI/HUD/SchematicDisplay.cs b/Assets/Scripts/UI/HUD/SchematicDisplay.cs index 6aae59a08..9f20950b3 100644 --- a/Assets/Scripts/UI/HUD/SchematicDisplay.cs +++ b/Assets/Scripts/UI/HUD/SchematicDisplay.cs @@ -223,8 +223,7 @@ public class SchematicDisplay : MonoBehaviour if(HullDurabilityFill) { _hull = _entity.Hull; - var hullData = _entity.ItemManager.GetData(_hull); - var dur = _hull.Durability / hullData.Durability; + var dur = _hull.Durability / GetMaxDurability(_hull); HullDurabilityFill.anchorMax = new Vector2(dur, 1); HullDurabilityLabel.text = $"{ActionGameManager.RuntimePlayerSettings.Format(dur * 100)}%"; } @@ -237,7 +236,7 @@ public class SchematicDisplay : MonoBehaviour x.ListElement.HeatFill.anchorMax = new Vector2(unlerp(itemData.MinimumTemperature, itemData.MaximumTemperature, x.Item.Temperature), 0); if (x.Cooldown != null) x.ListElement.CooldownFill.anchorMax = new Vector2(x.Cooldown.Progress, 1); - x.ListElement.DurabilityLabel.text = $"{(int)(x.Item.EquippableItem.Durability / itemData.Durability * 100)}%"; + x.ListElement.DurabilityLabel.text = $"{(int)(x.Item.EquippableItem.Durability / GetMaxDurability(x.Item.EquippableItem) * 100)}%"; if (x.Weapon.WeaponData.AmmoType != Guid.Empty) { if(x.Weapon.WeaponData.MagazineSize > 1) @@ -255,4 +254,21 @@ public class SchematicDisplay : MonoBehaviour } } } + + private float GetMaxDurability(ItemInstance item) + { + var typedItem = FindTypedItem(item); + if (typedItem != null && typedItem.Durability > 0) + return (float)typedItem.Durability; + + return _entity.ItemManager.GetData(item).Durability; + } + + private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item) + { + var itemId = item?.Data?.ItemId ?? Guid.Empty; + return itemId == Guid.Empty + ? null + : ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(itemId.ToString("D")); + } } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index c8783c149..e2fccabfd 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -89,6 +89,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. falling back to defaults. - The combat schematic HUD uses typed runtime catalog weapon facets for its static weapon icon strip before falling back to legacy `WeaponItemData`. + Hull and item durability percentages use typed max durability before falling + back to legacy `ItemData.Durability`. Runtime weapon behavior still owns ammo counts, active range, cooldowns, temperature, and durability display until those session facts have typed runtime surfaces.