Use typed catalog for pickup presentation

This commit is contained in:
Meta Vens 2026-06-14 00:05:05 +01:00
commit a9b90470a1
3 changed files with 23 additions and 3 deletions

Binary file not shown.

View file

@ -7,6 +7,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Cinemachine;
using GameCult.Aetheria.State.Unity;
using UniRx;
using UnityEngine;
using UnityEngine.Serialization;
@ -568,11 +569,12 @@ public class ZoneRenderer : MonoBehaviour
public void DropItem(Vector3 position, Vector3 velocity, ItemInstance item)
{
var typedItem = FindTypedPickupItem(item);
var gridObject = item switch
{
SimpleCommodity _ => Instantiate(SimpleCommodityPickup),
CompoundCommodity _ => Instantiate(CompoundCommodityPickup),
EquippableItem equippableItem when ItemManager.GetData(equippableItem) is WeaponItemData => Instantiate(WeaponPickup),
EquippableItem equippableItem when IsWeaponPickup(equippableItem, typedItem) => Instantiate(WeaponPickup),
EquippableItem _ => Instantiate(GearPickup),
_ => throw new NotImplementedException()
};
@ -584,7 +586,7 @@ public class ZoneRenderer : MonoBehaviour
var itemPickup = gridObject.gameObject.GetComponent<ItemPickup>();
itemPickup.Item = item;
itemPickup.ZoneRenderer = this;
itemPickup.ScanLabel.text = ItemManager.GetData(item).Name;
itemPickup.ScanLabel.text = typedItem?.Name ?? ItemManager.GetData(item).Name;
if (item is CraftedItemInstance craftedItemInstance)
{
var c = ItemManager.GetTier(craftedItemInstance).tier.Color.ToColor();
@ -595,6 +597,22 @@ public class ZoneRenderer : MonoBehaviour
gridObject.gameObject.AddComponent<TimedDestroy>().Duration = Settings.PickupLifetime;
_loot.Add(itemPickup);
}
private bool IsWeaponPickup(EquippableItem item, AetheriaRuntimeCatalogItem typedItem)
{
if (typedItem != null)
return string.Equals(typedItem.Category, nameof(WeaponItemData), StringComparison.Ordinal);
return ItemManager.GetData(item) is WeaponItemData;
}
private static AetheriaRuntimeCatalogItem FindTypedPickupItem(ItemInstance item)
{
var itemId = item?.Data?.ItemId ?? Guid.Empty;
return itemId == Guid.Empty
? null
: ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(itemId.ToString("D"));
}
}

View file

@ -135,7 +135,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
hydrating `ItemData` projections for legacy commodity filters, columns, and
buy actions. The sector properties UI also resolves station/turret/ship
counts through typed hull classifications from the runtime catalog before
falling back to legacy `HullData` projection for missing rows.
falling back to legacy `HullData` projection for missing rows. Loot pickup
presentation now uses typed catalog category/name rows to choose weapon-vs-gear
pickup visuals and scan labels before falling back to legacy item projections.
- `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