Use typed durability for item instantiation

This commit is contained in:
Meta Vens 2026-06-14 06:35:34 +01:00
commit 4e151cd61d
3 changed files with 13 additions and 2 deletions

Binary file not shown.

View file

@ -262,7 +262,7 @@ public class ItemManager
{
return new EquippableItem
{
Data = CreateReference(item), Quality = quality, Durability = equippableItemData.Durability
Data = CreateReference(item), Quality = quality, Durability = GetInitialDurability(equippableItemData)
};
}
@ -273,6 +273,12 @@ public class ItemManager
};
return newCommodity;
}
private float GetInitialDurability(EquippableItemData item)
{
var typedItem = GetRuntimeItem(item.ID);
return typedItem?.Durability > 0 ? (float)typedItem.Durability : item.Durability;
}
public CraftedItemInstance CreateInstance(CraftedItemData item)
{

View file

@ -230,7 +230,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
max durability only, with current runtime durability as the generic
denominator for incomplete typed rows. `ItemManager.Evaluate` also uses typed
runtime item max durability and item names when evaluating unequipped
performance stats.
performance stats. `ItemManager.CreateInstance(CraftedItemData, float)`
initializes new equippable runtime durability from the typed runtime item row;
`EquippableItemData.Durability` is only an incomplete-row fallback.
Inventory drag preview occupancy now projects typed item shape cells only into
the local `Shape` grid, and final fit/equip acceptance shares the typed
runtime catalog geometry path in `Entity.ItemFits` and `TryEquip`.
@ -759,6 +761,9 @@ First Aetheria surfaces to publish:
- Done: move unequipped `ItemManager.Evaluate` durability/name inputs onto
typed runtime item rows; legacy `EquippableItemData.Durability` no longer
owns that stat-evaluation path.
- Done: move new equippable instance durability initialization onto typed
runtime item rows; legacy `EquippableItemData.Durability` remains only as
an incomplete-row fallback in the instantiation bridge.
- Done: move `Ship` drag, combat/turret predicted shot height, and thruster
torque geometry onto typed hull facets and typed shape masks.
- Done: delete the console `give` command instead of preserving a debug