Use typed durability for inventory HUD tint

This commit is contained in:
Meta Vens 2026-06-14 00:58:13 +01:00
commit 8f53140196
3 changed files with 12 additions and 2 deletions

Binary file not shown.

View file

@ -817,7 +817,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
if (_displayedEntity.Armor[position.x, position.y] > .01f)
return Settings.ArmorGradient.Evaluate(_displayedEntity.Armor[position.x, position.y] / _displayedEntity.MaxArmor[position.x, position.y]);
if (item != null) return Settings.DurabilityGradient.Evaluate(item.Durability / _displayedEntity.ItemManager.GetData(item).Durability);
if (item != null) return Settings.DurabilityGradient.Evaluate(item.Durability / GetMaxDurability(item));
return float3(.25f).ToColor();
}
@ -873,6 +873,15 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
Enum.TryParse(typedItem.HardpointType, true, out hardpointType);
}
private float GetMaxDurability(ItemInstance item)
{
var typedItem = FindTypedInventoryItem(item);
if (typedItem != null && typedItem.Durability > 0)
return (float)typedItem.Durability;
return _displayedEntity.ItemManager.GetData(item).Durability;
}
private static AetheriaRuntimeCatalogItem FindTypedInventoryItem(ItemInstance item)
{
var itemId = item?.Data?.ItemId ?? Guid.Empty;

View file

@ -151,7 +151,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
typed behavior surfaces. Inventory selection highlighting now uses typed item
shape cells for UI tint geometry before falling back to legacy `ItemData.Shape`.
Inventory cargo cell tint now uses typed hardpoint facets before falling back
to legacy `EquippableItemData.HardpointType`.
to legacy `EquippableItemData.HardpointType`. Inventory HUD durability tint
uses typed max durability before falling back to legacy `ItemData.Durability`.
- `Galaxy` generation no longer accepts a runtime item catalog reader or `ItemManager`.
Sector and tutorial generation receive the package-owned typed runtime
catalog. `Galaxy` projects typed corporation v2 records into temporary legacy