From 26219ebd44ad21b8096222e0c03e297f74cc177e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 09:59:30 +0100 Subject: [PATCH] Use typed weapon behavior metadata --- .voidbot/state/aetheria.cc | Bin 84481 -> 84722 bytes .../Aetheria.State.Unity.csproj | 1 + .../UI/Properties Panel/PropertiesPanel.cs | 29 +---------------- .../Runtime/AetheriaRuntimeBehaviorKinds.cs | 30 ++++++++++++++++++ .../AetheriaRuntimeBehaviorKinds.cs.meta | 11 +++++++ docs/aetheria-perfect-machine-map.md | 11 ++++--- 6 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs create mode 100644 Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs.meta diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 28d51eeb42151f3b85a260aa50c8e3e8abba6da2..97a93154fe0ef0609b0e5e5b00678212cec52e92 100644 GIT binary patch delta 980 zcmZ8gO-vI(7|llumMC5f5RB20w#Xt~3$#>=5k+Hy1gr*QLPF?tceY)+-EC&4l18E; zH{(SY9pY7tdN9$0;YPf8@gz5YV!RnOUNG_Q{_;1sc{AVlzW3hD!cybkM~$zaH#BFm zsX?)?|K!vIXtmxq-1mWj0T(brHv=H!0+H~MhV0u#A-pPt0Ud^EKGO*u<293*h}Ek^ zMpazb3@n>NXpZ2jp$7mmiAE%*+K79*ils6x5>z1!%a~#DnWSO0@&!Kd+TTwO&X-? zCbL^3LqU1(@Pf^rw{fQp!@5NHwTTAFJe%DpL}l|PV-A~hzb?Vq>`!^dyzrW79nzoOh)TS!J1aE&EU7< zP=+P`I}Sf!malg~I>k!Vs1-}Lhpt(^X3uDECRFeRZz{CbW=8jIw}G#V(6RqYZhH@Y zc?ep?zPW{GJIdX?%Z{5o8G;O3WPAi3Z5}^DlmCWWqp(ChtBCruSds z_GFQp2H^{RpunWH@k?kySg~_MSeEUOTw7WKTf~~&cHkW kuccG|=WF7TVW|2w=?uR!49os*Fu97(!l!1xWN={WKS(K4@&Et; delta 651 zcmY+C!D|yy5XPA#t?e;NtrXF*-P9(vCACHpQyUc(#iF591VLfUK9j}Wee3S4VbM#~ zlUNj1or2&=@mf#0iH8c}so+KX2YB$NH$C~XNh%)ado#l~zxVxm-na6sZ~bjzAb)JO zI9)8|`SuCe9eqqZ?kR^uqnvXdwc5~QniNgaXHW~h&M-J&-@{5TB?Dzs8cP( zQ(a%DNs+c)6M^zWl&&2jX>-Eyq)%FLgd$V-@Q*RLz-0sW@^u3;u*we&sPL8n1YdYA z19J)Kb29@*x@RH~wy3qw<&6y7f{63u@EsO-_#hPc>9{6+f1%1xCg7TWyLT8?qjU4` z59IxN_rh&-OBxl@vT8`*Qem|6d2(^_qQvSp=qkCw{+|o}Ltwdej92JiXtR?yC$7Y} z+P7ylQ->@!;6KM + diff --git a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs index 4cc9a8f8a..64e856981 100644 --- a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs +++ b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs @@ -474,7 +474,7 @@ public class PropertiesPanel : MonoBehaviour } } - var weaponPayload = typedItem?.BehaviorPayloads.FirstOrDefault(payload => TypedBehaviorMatches(payload, WeaponBehaviorMatcher)); + var weaponPayload = typedItem?.BehaviorPayloads.FirstOrDefault(payload => AetheriaRuntimeBehaviorKinds.IsWeapon(payload.Kind)); if (weaponPayload != null) { var damageCurve = ReadTypedBezierCurve(FindTypedBehaviorField(weaponPayload, 7)?.Value); @@ -561,17 +561,6 @@ public class PropertiesPanel : MonoBehaviour : fallback; } - private static bool TypedBehaviorMatches(AetheriaRuntimeBehaviorPayload payload, BehaviorKindMatcher matcher) - { - if (string.Equals(payload.Kind, matcher.Kind, StringComparison.Ordinal)) - { - return true; - } - - var payloadType = ResolveBehaviorType(payload.Kind); - return payloadType != null && matcher.MetadataType.IsAssignableFrom(payloadType); - } - private static Type ResolveBehaviorType(string kind) { return string.IsNullOrWhiteSpace(kind) @@ -587,22 +576,6 @@ public class PropertiesPanel : MonoBehaviour .GroupBy(type => type.Name) .ToDictionary(group => group.Key, group => group.First(), StringComparer.Ordinal); - private static readonly BehaviorKindMatcher WeaponBehaviorMatcher = new BehaviorKindMatcher( - nameof(WeaponData), - typeof(WeaponData)); - - private readonly struct BehaviorKindMatcher - { - public BehaviorKindMatcher(string kind, Type metadataType) - { - Kind = string.IsNullOrWhiteSpace(kind) ? "" : kind; - MetadataType = metadataType ?? throw new ArgumentNullException(nameof(metadataType)); - } - - public string Kind { get; } - public Type MetadataType { get; } - } - private string GetTitle(EquippableItem item) { var typedItem = FindTypedPropertyItem(item); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs new file mode 100644 index 000000000..b5e80ba43 --- /dev/null +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace GameCult.Aetheria.State.Unity +{ + public static class AetheriaRuntimeBehaviorKinds + { + public const string GuidedWeapon = "GuidedWeapon"; + public const string Launcher = "Launcher"; + public const string InstantWeapon = "InstantWeapon"; + public const string ConstantWeapon = "ConstantWeapon"; + public const string ChargedWeapon = "ChargedWeapon"; + public const string AutoWeapon = "AutoWeapon"; + + private static readonly ISet WeaponKinds = new HashSet(StringComparer.Ordinal) + { + GuidedWeapon, + Launcher, + InstantWeapon, + ConstantWeapon, + ChargedWeapon, + AutoWeapon + }; + + public static bool IsWeapon(string kind) + { + return !string.IsNullOrWhiteSpace(kind) && WeaponKinds.Contains(kind); + } + } +} diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs.meta b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs.meta new file mode 100644 index 000000000..286b496dc --- /dev/null +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeBehaviorKinds.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f03e4d7d6e841a4a9a37b4c9d25cc5a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index b5c2b76b1..e5cc544e2 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -226,9 +226,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. performance curve keys for basic item presentation without hydrating legacy DTOs. Runtime behavior stat display and damage-range curves read typed behavior payload fields by legacy payload key. Damage-range payload selection - is keyed by typed behavior kind (`WeaponData`); legacy `BehaviorData` ancestry - is only a temporary metadata fallback while typed behavior metadata/factory - documents are missing. The old explicit + is keyed by package-owned typed weapon behavior metadata; legacy + `BehaviorData` ancestry is no longer a fallback for weapon payload selection. + The old explicit `Inspect(ItemData)` DTO inspection overload is deleted; trade row clicks now inspect the typed runtime catalog row directly. Incomplete typed thermal curve rows render a neutral fallback curve instead of hydrating legacy @@ -762,8 +762,9 @@ First Aetheria surfaces to publish: `Inspect(ItemData)` projection inspector after moving trade row inspection onto typed runtime catalog rows. - Done: demote PropertiesPanel weapon damage-range payload matching from - `BehaviorData` `Type` authority to a typed behavior kind key; reflection - remains metadata-only until typed behavior metadata/factory documents exist. + `BehaviorData` `Type` authority to package-owned typed weapon behavior + metadata; `BehaviorData` reflection remains display/filter metadata-only + until typed behavior metadata/factory documents exist. - Done: remove the loot pickup presentation fallback to legacy `ItemData`; typed category/name rows now decide pickup visuals and scan labels, and missing typed rows render generic unknown gear pickup presentation.