From 18dc4a61cea4483403edc0bb8f1e936b1769ae98 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 05:51:15 +0100 Subject: [PATCH] Use typed payloads for behavior construction --- .voidbot/state/aetheria.cc | Bin 68078 -> 68462 bytes .../AetheriaRuntimeItemCatalog.cs | 22 ++++++++++++++---- Assets/Scripts/ServerShared/Entity.cs | 4 ++-- Assets/Scripts/ServerShared/ItemManager.cs | 8 +++++++ docs/aetheria-perfect-machine-map.md | 11 +++++++-- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 57c09ee1f4ca49a380464045922c42a5f5fbb28d..5e52af41c4646282917c7493413e4274cbc17762 100644 GIT binary patch delta 1375 zcmb7EOK2295H*{Cu96VNXov($MEqbjF@E-+@9_-BY?6#Si-t_crTm*yW z;6Xv8L5~V5f*w?sTs(>5!Gpx$#gKSZ^b%3L32JrE>?i8Q%P><@UG?6pS3Rfd=5EwI zzMn|;Y~R|Q>g?$myk66!UM8+afv%3U3GmwUaUdN97S**TesmSr*IBQU_l}0XWF7_e zXktaJ&qq~jdbQ^W?t#ow*h%pz7y%KdSws?-XMp*Eq{Ig9011YfpMh+_7DQ4T_DSmP z#x%$YewJF2aX$cu3(&z-AI*|H<044ivs}Ww=}&5MxMd9Jxf~B@0R2>!QVv(nZ|D!1 zy>YXteSr8RLq+w8n8d#hYBc*0Eb%Rh1&D9Mo{^B{a@5wp+IJzk&>JH|F4fq`+DHvk{?sYt=zP==xkbcDx-Q7(od$nwy&!KN<7-sm2SyDrHE6ttp8 zw1px`9jU!QtZapS*0hc|L@LD;qQ(!<3t29XQYV;Quy*{8pw9GuwI;tpHQs7a*G8Jv z>#6$U^EaJ~4-RNg{FmW?=Mj(Iomj)Ni9x8HGdt9wA1%!TecUd9M{+m=iwhekZJeZ+ zaGf@ZJ};<8n6FoBo`<4&tM@afYEJ6a=`AlpdHNM2mdt9ZSN_L_6?`-(UYPZg>h_5Z z>hgyM)pDls)amN|Fbfmy$R8`B9b+b1);(@kx+*H|$`Yv0A3U|Zw^O~l!i#S|jx1Rk zU0vNBgLfs#;5gcg$G`cB`iDl3He8+c r)~-}be?E(Dy>!Pma}9p^nU4coI!$2w*QHXxWK68Bd7dmqdIo<3U~vQi delta 1072 zcmZWoO-NKx6z(}gX^~}Fiu7|0szo|!YFRF%{2@W8Y#^B0+s7%fqS1x=k%-aVc#=jEb}nonc4r>ymMGZQ;m{ER!aYhyqtyvZSULnn$yc zV;m6bc)qmUJXtr;Mg$`en`;l%BC`jaN*_ydj7g7Mt|WP24oF^74W}B*Hsq;ZihT{H zFNoB<1XozhU3~s;Qbb4#gD^`5_QQn!_lFFeART@j>gp)c=RuZ18t1^I1&i?@hjpJw zqV=gSADh(o>Du<deL^KFCp0^$jBAM$`Hyye)$04^ks#*(s)y@a?>dr)SrR78a zR&7jWmJXAq^dO5dTsq)tYV@S?UT#mP&vMg5Cbl(1@3o^l^GMP>M$lGy z_`|KK4E(IGtF7Lt_lcIx(I2&%XjZeoU&XJuyEk~&cbQg*4|+O-gZl|hySXK*=uvBl PrWbRX_PVZ$>COBB@XU@7 diff --git a/Assets/Scripts/ServerShared/AetheriaRuntimeItemCatalog.cs b/Assets/Scripts/ServerShared/AetheriaRuntimeItemCatalog.cs index 89d3fd1a9..f5e94f4d1 100644 --- a/Assets/Scripts/ServerShared/AetheriaRuntimeItemCatalog.cs +++ b/Assets/Scripts/ServerShared/AetheriaRuntimeItemCatalog.cs @@ -9,6 +9,7 @@ using Unity.Mathematics; public interface IRuntimeItemProjectionReader { AetheriaRuntimeCatalogItem GetRuntimeItem(Guid guid); + IReadOnlyList GetBehaviorProjections(Guid guid); ItemData Get(Guid guid); T Get(Guid guid) where T : ItemData; } @@ -72,6 +73,14 @@ public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemProjectionReader return item; } + public IReadOnlyList GetBehaviorProjections(Guid guid) + { + var item = GetRuntimeItem(guid); + return item == null + ? Array.Empty() + : ProjectBehaviors(item); + } + public ItemData Get(Guid guid) { ItemData item; @@ -115,10 +124,7 @@ public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemProjectionReader if (projected is EquippableItemData equippable) { equippable.Durability = (float)item.Durability; - equippable.Behaviors = item.BehaviorPayloads - .Select(ProjectBehavior) - .Where(behavior => behavior != null) - .ToList(); + equippable.Behaviors = ProjectBehaviors(item).ToList(); } if (projected is GearData gear) @@ -158,6 +164,14 @@ public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemProjectionReader return projected; } + private static BehaviorData[] ProjectBehaviors(AetheriaRuntimeCatalogItem item) + { + return item.BehaviorPayloads + .Select(ProjectBehavior) + .Where(behavior => behavior != null) + .ToArray(); + } + private static ItemData CreateItemData(AetheriaRuntimeCatalogItem item) { switch (item.Category) diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index 84b811045..4c141a8b3 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -1217,7 +1217,7 @@ public class ConsumableItemEffect Data = entity.ItemManager.GetData(item) as ConsumableItemData; RemainingDuration = Data.Duration; - Behaviors = Data.Behaviors + Behaviors = entity.ItemManager.GetRuntimeBehaviorProjections(item) .Select(bd => bd.CreateInstance(this)) .ToArray(); } @@ -1391,7 +1391,7 @@ public class EquippedItem .CombineLatest(Online, (enabled, online) => enabled && online).DistinctUntilChanged()); - Behaviors = Data.Behaviors + Behaviors = ItemManager.GetRuntimeBehaviorProjections(item) .Select(bd => bd.CreateInstance(this)) .ToArray(); diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index 8e8cafa3c..ff72d8e07 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -69,6 +69,14 @@ public class ItemManager return itemId == Guid.Empty ? null : _itemProjections.GetRuntimeItem(itemId); } + public IReadOnlyList GetRuntimeBehaviorProjections(ItemInstance item) + { + var itemId = item?.Data?.ItemId ?? Guid.Empty; + return itemId == Guid.Empty + ? Array.Empty() + : _itemProjections.GetBehaviorProjections(itemId); + } + public Shape GetRuntimeShape(ItemInstance item) { var typedItem = GetRuntimeItem(item); diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 7f17e4b3d..84c0f7716 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -191,8 +191,12 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. hydration is only the remaining item-instantiation bridge. Docking bay max ship size is imported as typed item state and `EquippedDockingBay.MaxSize` derives from the typed runtime catalog row. `EquippedItem.InsetShape` now - derives from typed hull/item shape rows. `EquippedItem` behavior construction - still belongs to legacy simulation projections until that owner is rebuilt. + derives from typed hull/item shape rows. `EquippedItem` and + `ConsumableItemEffect` behavior construction now read typed behavior payloads + through the runtime behavior projection bridge before instantiating the + current `BehaviorData`-backed behavior classes. `BehaviorData` remains the + temporary behavior-class config bridge, not the runtime behavior payload + owner. Ship drag, combat/turret shot prediction height, and thruster torque geometry now consume typed hull facets and typed shape masks. The item properties panel also reads typed catalog title names, descriptions, @@ -707,6 +711,9 @@ First Aetheria surfaces to publish: - Done: move `EquippedItem.InsetShape` construction onto typed hull and item shape rows; legacy `HullData.Shape`/`EquippableItemData.Shape` no longer decide equipped-item temperature footprint geometry. + - Done: move `EquippedItem` and `ConsumableItemEffect` behavior construction + off `Data.Behaviors` and onto typed runtime behavior payload projection; + `BehaviorData` remains only the temporary behavior-class config bridge. - Done: move final `Entity.ItemFits`, `TryFindSpace`, `TryEquip`, and `TryUnequip` gear occupancy/mass deltas onto typed catalog rows for item shape, hull shape/interior, hardpoint masks, cargo/docking category, and