From da27eb39b66c6b918863c74d8c5cd9d711f82df8 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 02:49:55 +0100 Subject: [PATCH] Bind consumables with typed action bar rows --- .voidbot/state/aetheria.cc | Bin 59938 -> 60113 bytes Assets/Scripts/Gameplay/ActionBarSlot.cs | 43 +++++++++++++------ Assets/Scripts/Gameplay/ActionGameManager.cs | 16 ++++--- docs/aetheria-perfect-machine-map.md | 13 ++++-- 4 files changed, 51 insertions(+), 21 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 6ca42983b473d816a32da80a3388afad736bba81..6bca45e8dc2e451af1c9ef42ec378bc46b295cf5 100644 GIT binary patch delta 1258 zcmZ`(&r4KM6i%m14Ra7t(!fIrrRa=5CL1e)!6XK;g(!p=ap%4J=DmFL?r`6o(Qz}h z3)&c$a$C_4XcfF=3pcrOQ-LCxX8%H~XxF*#y?H9wW_b5-@AsYWJKvetTd{B3v5)WS z8&jzpqeF?*hz~tcS-0)VL=se?<6Vb8rAKC6IxPl=X2ow1NEY6m0f=%;8JMpFE*64Mx z$%7ZUhy{HKc%eE8mMU^@(9=~rMxlRp(YQi0W z=rUcVT1h<{@UbkM0~CocQ9q|>r+^BLx-U7(CU8sKAR2WON7O^`lCwuhpt`VTTre$N zrw(9W=%DfenG&)Vhc#CiF*Iqsd+dmCqGgXQp-E7~Xp;IJi}uQ1lyo0Y5T3`(L|D;Agv3gv_0}_nv#s$-G-_JbK@F@pO1}YWn2# zOmntN7lEmxs}z}y}7x4-;Jx9 z1$Y5v29|jOL8~PLQY}Gd(2aHWJMY$xZkz|2S*~RBi7yyWJ`e3(%aaO(k`Zb^MsJZr z!cqgch&l(K=|};$n1EHlB+S$2Ic6E0yLzc?)`T;Z?lS>Z#Rck2IhvyZ8)J2Rev34g zNgp8(Z^nhT?Ie3}}5dzgCEJ>mQZgVi1S0bkq9ttzjgF-0#2nkXs&?gzX zlF~$$NZL)fF(uyK(4~6yTp8(re#|8IO%pC>n!XM76vXg9gPRn69&#UuWZN%H^erO! zz*2jZ)Y{94nsNkcw6EeYNvO<3nS_L0hs-CYG5AtBV zs(q@}t!hR|I>uG!L=lp{Ihs9&D+h&Ik*g}#4s@HSiRr6#m|4qw(l!F`A4Z;&p<<;M zFf?D*Ma5!rY~z(H7g$Q8`bv}BYX%=s3#EOuiFsNvs4-z&mZixPrR=q=9@#5krG?$; z`MvJ$+(Gv`A1mhUq0NZr6$?~m;oAI!L6T09mdq!o*Z-V>`ovk0A=#RYS~aVQAsep6 zX;alKUME~wnTcCdtlYhK)Qw);TKsvk>)7_z%*j@(*=|jC9$OaCxM6YNt=v#7+?*RL zo~~{kam(?jd)L@qUmmU5sp|6h{q _resolveLegacyTarget; - public ActionBarConsumableBinding(Entity entity, ActionBarSlot slot, ConsumableItemData target) : base(entity, slot) + public ActionBarConsumableBinding( + Entity entity, + ActionBarSlot slot, + AetheriaRuntimeCatalogItem target, + Func resolveLegacyTarget) : base(entity, slot) { Target = target; + _resolveLegacyTarget = resolveLegacyTarget; Slot.QuantityRemaining.gameObject.SetActive(true); - var data = Target; - if(!string.IsNullOrEmpty(data.Icon)) - { - Slot.Label.gameObject.SetActive(false); - Slot.Icon.gameObject.SetActive(true); - Slot.Icon.texture = Resources.Load(data.Icon.Substring("Assets/Resources/".Length).Split('.').First()); - } - else Slot.Icon.gameObject.SetActive(false); + Slot.Label.gameObject.SetActive(false); + Slot.Icon.gameObject.SetActive(false); } public override void Activate() { - Entity.TryActivateConsumable(Target); + var legacyTarget = ResolveLegacyTarget(); + if (legacyTarget != null) + Entity.TryActivateConsumable(legacyTarget); } public override void Deactivate() @@ -84,11 +86,26 @@ public class ActionBarConsumableBinding : ActionBarBinding public override void Update() { - Slot.QuantityRemaining.text = $"{Entity.CountItemsInCargo(Target.ID)}"; - var instance = Entity.FindActiveConsumable(Target); + Slot.QuantityRemaining.text = $"{Entity.CountItemsInCargo(TargetLegacyId)}"; + var legacyTarget = ResolveLegacyTarget(); + if (legacyTarget == null) + { + Slot.Fill.fillAmount = 0; + return; + } + + var instance = Entity.FindActiveConsumable(legacyTarget); if (instance == null) Slot.Fill.fillAmount = 0; else Slot.Fill.fillAmount = instance.RemainingDuration / instance.Data.Duration; } + + private Guid TargetLegacyId => + Guid.TryParse(Target.LegacyId, out var legacyId) ? legacyId : Guid.Empty; + + private ConsumableItemData ResolveLegacyTarget() + { + return _resolveLegacyTarget?.Invoke(); + } } public class ActionBarGearBinding : ActionBarBinding diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index c11452367..5fa47466e 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -729,9 +729,13 @@ public class ActionGameManager : MonoBehaviour slot.Binding = new ActionBarGearBinding(CurrentEntity, slot, equippedItemDragAction.EquippedItem, trigger); return true; case ItemInstanceDragObject itemInstanceDragAction: - if (!IsRuntimeConsumableItem(itemInstanceDragAction.Item)) return false; - if (!(ItemManager.GetData(itemInstanceDragAction.Item) is ConsumableItemData consumable)) return false; - slot.Binding = new ActionBarConsumableBinding(CurrentEntity, slot, consumable); + var consumable = FindTypedActionBarConsumable(itemInstanceDragAction.Item); + if (consumable == null) return false; + slot.Binding = new ActionBarConsumableBinding( + CurrentEntity, + slot, + consumable, + () => ItemManager.GetData(itemInstanceDragAction.Item) as ConsumableItemData); return true; case WeaponGroupDragObject weaponGroupDragAction: slot.Binding = new ActionBarWeaponGroupBinding(CurrentEntity, slot, weaponGroupDragAction.Group); @@ -749,11 +753,13 @@ public class ActionGameManager : MonoBehaviour return slot; } - bool IsRuntimeConsumableItem(ItemInstance item) + AetheriaRuntimeCatalogItem FindTypedActionBarConsumable(ItemInstance item) { var typedItem = FindTypedActionBarItem(item); return typedItem != null && - string.Equals(typedItem.Category, nameof(ConsumableItemData), StringComparison.Ordinal); + string.Equals(typedItem.Category, nameof(ConsumableItemData), StringComparison.Ordinal) + ? typedItem + : null; } AetheriaRuntimeCatalogItem FindTypedActionBarItem(ItemInstance item) diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index f7be28e29..fbee86845 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -79,9 +79,13 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. the durable owner. Binding drag/drop and action-bar remapping both queue the 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. Missing typed rows are rejected for - consumable binding instead of falling through to legacy DTO classification. + non-consumable inventory drops and creates consumable bindings around typed + catalog rows before hydrating any legacy DTO. Missing typed rows are rejected + for consumable binding instead of falling through to legacy DTO classification. + Consumable activation and active-duration fill still resolve legacy + `ConsumableItemData` lazily because runtime effects and duration are not typed + execution surfaces yet; consumable icon projection is hidden until typed icon + fields exist. Gear action-bar bindings use typed weapon and hardpoint facets for fallback icon selection and fall back to a generic tool icon when typed facets are incomplete; legacy custom action-bar icon paths remain fallback projection @@ -622,6 +626,9 @@ First Aetheria surfaces to publish: `TradeRow` fields; legacy `ItemData` hydration is lazy and bounded to commodity subtype detail, behavior reflection columns, missing typed rows, and buy mechanics. + - Done: move action-bar consumable drop binding onto typed catalog rows; + legacy `ConsumableItemData` resolution is lazy and bounded to activation + and active-duration fill until typed consumable effect execution exists. - Done: delete the console `give` command instead of preserving a debug operator path that hydrated typed item rows back into legacy item DTOs. - Done: delete `ItemManager.GetCatalogEntries` after all live callers