Use typed durability for presentation

This commit is contained in:
Meta Vens 2026-06-14 02:05:26 +01:00
commit b33bccea45
7 changed files with 27 additions and 11 deletions

Binary file not shown.

View file

@ -66,6 +66,10 @@ var weaponItems = items.Count(item =>
!string.IsNullOrWhiteSpace(item.WeaponType) &&
!string.IsNullOrWhiteSpace(item.WeaponRange) &&
!string.IsNullOrWhiteSpace(item.WeaponCaliber));
var maxDurabilityItems = items
.Where(item => !string.IsNullOrWhiteSpace(item.HullType) || !string.IsNullOrWhiteSpace(item.WeaponType))
.ToArray();
var durableMaxDurabilityItems = maxDurabilityItems.Count(item => item.Durability > 0);
var describedCorporations = corporations.Count(corporation => !string.IsNullOrWhiteSpace(corporation.Description));
var corporationNameLinks = corporations.Count(corporation => !string.IsNullOrWhiteSpace(corporation.GeonameFileLegacyId));
var corporationAllegianceEdges = corporations.Sum(corporation => corporation.Allegiances.Length);
@ -130,6 +134,16 @@ if (hardpointHostItems == 0 || hardpointCount == 0)
throw new InvalidOperationException("Typed item definitions did not import any hull hardpoints.");
}
var missingMaxDurability = maxDurabilityItems
.Where(item => item.Durability <= 0)
.Select(item => item.Name)
.ToArray();
if (missingMaxDurability.Length > 0)
{
throw new InvalidOperationException(
$"Typed hull/weapon max durability missing for: {string.Join(", ", missingMaxDurability)}.");
}
foreach (var item in items.Where(item => item.Hardpoints.Length > 0))
{
foreach (var hardpoint in item.Hardpoints)
@ -299,6 +313,7 @@ Console.WriteLine($"Shape masks: {shapedMaskItems}");
Console.WriteLine($"Interior masks/hardpoint hosts/hardpoints: {interiorShapeItems}/{hardpointHostItems}/{hardpointCount}");
Console.WriteLine($"Behavior payload items/payloads/fields/legacy refs: {behaviorPayloadItems}/{behaviorPayloadCount}/{behaviorFieldCount}/{behaviorLegacyRefCount}");
Console.WriteLine($"Behavior/hardpoint/hull/weapon items: {behaviorItems}/{hardpointItems}/{hullItems}/{weaponItems}");
Console.WriteLine($"Durable hull/weapon items: {durableMaxDurabilityItems}/{maxDurabilityItems.Length}");
Console.WriteLine($"Typed catalog trade items: {tradeItems.Length}");
Console.WriteLine($"Eve catalog surface: {surface.Surface.Id} ({surface.Surface.Root.Children.Length} root children)");
Console.WriteLine($"Corporations: {corporations.Length}");

View file

@ -143,7 +143,7 @@ public class ShipInstance : EntityInstance
if (typedItem != null && typedItem.Durability > 0)
return (float)typedItem.Durability;
return Entity.ItemManager.GetData(item).Durability;
return Math.Max(item.Durability, 1f);
}
private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)

View file

@ -259,7 +259,7 @@ public class SchematicDisplay : MonoBehaviour
if (typedItem != null && typedItem.Durability > 0)
return (float)typedItem.Durability;
return _entity.ItemManager.GetData(item).Durability;
return Math.Max(item.Durability, 1f);
}
private static AetheriaRuntimeCatalogItem FindTypedItem(ItemInstance item)

View file

@ -874,7 +874,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
if (typedItem != null && typedItem.Durability > 0)
return (float)typedItem.Durability;
return _displayedEntity.ItemManager.GetData(item).Durability;
return Math.Max(item.Durability, 1f);
}
private Shape GetItemShape(ItemInstance item)

View file

@ -405,7 +405,7 @@ public class PropertiesPanel : MonoBehaviour
if (typedItem != null && typedItem.Durability > 0)
return (float)typedItem.Durability;
return GameManager.ItemManager.GetData(item).Durability;
return Math.Max(item.Durability, 1f);
}
private static AetheriaRuntimeCatalogItem FindTypedPropertyItem(ItemInstance item)

View file

@ -91,13 +91,13 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
- The combat schematic HUD uses typed runtime catalog weapon facets for its
static weapon icon strip; missing typed weapon facets no longer fall back to
legacy `WeaponItemData`.
Hull and item durability percentages use typed max durability before falling
back to legacy `ItemData.Durability`.
Ship thruster VFX emission scaling also uses typed max durability before
falling back to legacy `ItemData.Durability`.
Hull and item durability percentages use typed max durability only; incomplete
typed rows use current runtime durability as the generic denominator instead
of falling back to legacy `ItemData.Durability`.
Ship thruster VFX emission scaling also uses typed max durability only.
Runtime weapon behavior still owns ammo counts, active range, cooldowns,
temperature, and durability display until those session facts have typed
runtime surfaces.
temperature, and current durability values until those session facts have
typed runtime surfaces.
- `Aetheria.State` now exposes typed node put/get ports for run state, zone
state, and entity snapshots. The state smoke writes a run referencing a zone,
a zone referencing an entity snapshot, and an entity snapshot carrying
@ -162,7 +162,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
Inventory cargo cell tint now uses typed hardpoint facets only; incomplete
typed rows receive the generic tint instead of falling back to legacy
`EquippableItemData.HardpointType`. Inventory HUD durability tint uses typed
max durability before falling back to legacy `ItemData.Durability`.
max durability only, with current runtime durability as the generic
denominator for incomplete typed rows.
Inventory drag preview occupancy now projects typed item shape cells only into
the local `Shape` grid; final fit and equip acceptance still belong to
`ItemFits`, `TryEquip`, and inventory mutation paths until those simulation