diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index dfe48b88e..64a01e6fa 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Assets/Scripts/Gameplay/ActionBarSlot.cs b/Assets/Scripts/Gameplay/ActionBarSlot.cs index 0c6f29c76..69f3bd713 100644 --- a/Assets/Scripts/Gameplay/ActionBarSlot.cs +++ b/Assets/Scripts/Gameplay/ActionBarSlot.cs @@ -1,4 +1,6 @@ +using System; using System.Linq; +using GameCult.Aetheria.State.Unity; using TMPro; using UniRx.Triggers; using UnityEngine; @@ -99,16 +101,38 @@ public class ActionBarGearBinding : ActionBarBinding public ActionBarGearBinding(Entity entity, ActionBarSlot slot, EquippedItem item, IActivatedBehavior behavior) : base(entity, slot) { Item = item; - var data = entity.ItemManager.GetData(item.EquippableItem); Behavior = behavior; Slot.QuantityRemaining.gameObject.SetActive(false); Slot.Icon.gameObject.SetActive(true); Slot.Label.gameObject.SetActive(false); if (!string.IsNullOrEmpty(Item.Data.ActionBarIcon)) Slot.Icon.texture = Resources.Load(Item.Data.ActionBarIcon.Substring("Assets/Resources/".Length).Split('.').First()); - else if (data is WeaponItemData weaponItemData) - Slot.Icon.texture = ActionGameManager.Instance.Settings.GetIcon(weaponItemData.WeaponType).texture; - else Slot.Icon.texture = ActionGameManager.Instance.Settings.GetIcon(data.HardpointType).texture; + else Slot.Icon.texture = ResolveIconTexture(); + } + + private Texture2D ResolveIconTexture() + { + var typedItem = FindTypedGearItem(Item.EquippableItem); + if (typedItem != null) + { + if (Enum.TryParse(typedItem.WeaponType, out var weaponType)) + return ActionGameManager.Instance.Settings.GetIcon(weaponType).texture; + + if (Enum.TryParse(typedItem.HardpointType, out var hardpointType)) + return ActionGameManager.Instance.Settings.GetIcon(hardpointType).texture; + } + + return Item.Data is WeaponItemData weaponItemData + ? ActionGameManager.Instance.Settings.GetIcon(weaponItemData.WeaponType).texture + : ActionGameManager.Instance.Settings.GetIcon(Item.Data.HardpointType).texture; + } + + private static AetheriaRuntimeCatalogItem FindTypedGearItem(ItemInstance item) + { + var itemId = item?.Data?.ItemId ?? Guid.Empty; + return itemId == Guid.Empty + ? null + : ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(itemId.ToString("D")); } public override void Activate() diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 907eb1bd9..656de04cd 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -80,9 +80,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. same typed player-settings commit after mutating the runtime projection. The action bar also uses typed runtime catalog category rows to reject non-consumable inventory drops before hydrating the legacy consumable DTO - still required by activation APIs. Unity boot reads typed player settings - back through the package-owned CultCache reader before falling back to - defaults. + still required by activation APIs. Gear action-bar bindings use typed weapon + and hardpoint facets for fallback icon selection instead of hydrating item + DTOs to classify the icon; legacy custom action-bar icon paths remain fallback + projection data. Unity boot reads typed player settings back through the + package-owned CultCache reader before falling back to defaults. - `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