From 05c3e88b106dea9e6c365286e96cd89c523fb657 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 23:26:50 +0100 Subject: [PATCH] Prefilter loadout hull roles with typed catalog --- .voidbot/state/aetheria.cc | Bin 53626 -> 53501 bytes .../Scripts/ServerShared/LoadoutGenerator.cs | 19 +++++++++++++++--- docs/aetheria-perfect-machine-map.md | 12 ++++++----- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index fe8895e1de80f3a71b9be9b1796bfd4d691f4614..a2fc461ff4f9c64758144605065550c151a361aa 100644 GIT binary patch delta 950 zcmZuwJ5N+W6c&~c7d5_Ogo5N$*uctT5qvZ&Bx*#78yYt@vv<$#4$QrCotevKZ3wlM z-o`=;6tyssP1eR}BAOtrEs2T#3loirXYOMWrMve$zVn^$oAdK&=J#5r^`g6PJbz(q zG&h-_EIsHt6>fFkPa{)fQAB3$rIGVfQRHCHVE5*y_L-iyk5_KbNmh}8fqEbWn5K`w zyb3tdGfIjPS5^XnP{ul2=2C%EM`uZcCmY}^ta4#cf%KwA>SBfoSpy{-I``ZWjJrGE zi-afLs}?@4*HA!HN5xq&2wxQruUs?e=4`=&9bd+(R0#EEMKQy@8raM%ArJ4zOrt=@ zaH5ccUrxAQ=UznvVZn@amV9n32GH+9pcI;!cte3|B})7^_6jm(GiOu4sLWS#F&?OM zFAaK{M(;eF!y0p%U>Aw1tb}{owBfWrsaoaAC8{11pt&0eTJaWd44G&x^5Fu$Z;xny5Bp#yRHH#4*+dSR>+HT0b0I7W0>X=l8i_fO-TqM&( zGZ7hgi8sg>1i_cFLoZ_IX`_Nz=Xe$RrGABX1Fld5`3bWN^B~KM*dAKHd1$D3gZY$q zq#_sMUH+v>tA>v@27AkjS85o(+4xl`{q~va7KTgi^4kPO2x>r+C})#yZs+apnAw?iW;W*u5-idi zx3x+9S!v)ZMUWIm#Ktz_Kaf((fZ&_m+l$!keDCe|zIop_f3`}8+ohdX-TjrxOJft| zsj=$HX4gPUKKG{Ix;HxLOopn`!vY!4`;PYvb?;tjUFdoLY(2WEC{u|g0Z7o)awUmW z4Wi*5c-D|eX&@ezj5BJ%5MQf^*k%k2QA>pih*k|l>fpQ1u*n>W49J3oXdXLAtd*le zVpD$U3Cg4W-|eB-VLcnFG@)@UIP&Mzu?C+D3mOMvF{GNsic6c7hlvSk48-RaKW(nL zPMbLpCPIv$GzgS#4ii+4+CsXr%b6wh2XL)NSAj8*XL@NXO9$Xh$xqaC@GK> z|MR(|f(Qtx*Cd8ViO7d~A$Y4Mn}Pk7O3SlC`LzXU@W%T;Y9SP>MIvLl5QIStk~#i1 zXIkApTXuttih#fa>e(aFxC_SJh0HLiqfz;W(ygnf@46l5>vxu^hRp3!KH;tcf(N|L z1-DJ&^Z{iAYeybg6gOX6>Nx3hZEU*v_0+|KYl%(JPti_?mtYo5s1kv`E4-&n0Eexi z)9JzXbT3H|6KXz*^`?U4w`QnN53%6*Dzj{jJHVdi$B`E#%b|@WqcQ|^ZmZkQeXz4^2xn0gf zddFQO0;gi6b$jPr|H<|Xt5jBASQ?n0$Ii4iKFoFXzli{!1}1hhU96hc(#I#q`#Qbp v_tIeT<|ZcFZ}U@uOjg?OvN!G7Qw2ITnxRkk9(Ry&hqS6+cKZrwdS>M>r=@YK diff --git a/Assets/Scripts/ServerShared/LoadoutGenerator.cs b/Assets/Scripts/ServerShared/LoadoutGenerator.cs index ecd079481..047ba5570 100644 --- a/Assets/Scripts/ServerShared/LoadoutGenerator.cs +++ b/Assets/Scripts/ServerShared/LoadoutGenerator.cs @@ -128,9 +128,10 @@ public class LoadoutGenerator public HullData RandomHull(HullType type, Predicate hullFilter = null) { - return RandomItem(0, item => + return RandomItem(0, item => (hullFilter?.Invoke(item) ?? true) && - item.HullType == type); + item.HullType == type, + item => string.Equals(item.HullType, type.ToString(), StringComparison.Ordinal)); } public T[] RandomItems( @@ -233,6 +234,12 @@ public class LoadoutGenerator FitsWithin(item, hardpoint.Shape, hardpoint.Rotation); } + private static bool HasBehaviorKind(AetheriaRuntimeCatalogItem item, string behaviorKind) + { + return !string.IsNullOrWhiteSpace(behaviorKind) && + item.BehaviorKinds.Contains(behaviorKind, StringComparer.Ordinal); + } + private static bool FitsWithin(AetheriaRuntimeCatalogItem item, Shape target) { return ToShape(item.ShapeWidth, item.ShapeHeight, item.ShapeCells).FitsWithin(target, out _, out _); @@ -263,8 +270,14 @@ public class LoadoutGenerator { if (hardpoint.Type == HardpointType.ControlModule) { + var controllerBehaviorKind = entity is Ship + ? nameof(CockpitData) + : entity is OrbitalEntity + ? nameof(TurretControllerData) + : null; var controllerData = RandomItem(hardpoint, 2, - item => item.Behaviors.Any(b => entity is Ship && b is CockpitData || entity is OrbitalEntity && b is TurretControllerData)); + item => item.Behaviors.Any(b => entity is Ship && b is CockpitData || entity is OrbitalEntity && b is TurretControllerData), + item => HasBehaviorKind(item, controllerBehaviorKind)); if (controllerData == null) throw new InvalidLoadoutException("No compatible controller found for entity!"); var controller = ItemManager.CreateInstance(controllerData) as EquippableItem; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 3f1a444f9..c207a93df 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -122,9 +122,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. commands, not in-client catalog hydration shortcuts. `LoadoutGenerator` also receives the typed runtime catalog and uses it to own item candidate selection before hydrating selected legacy item DTOs by ID for - remaining behavior construction and legacy simulation checks. Hardpoint type, - shape fit, station bay fit, hull/category, and behavior-kind prefilters now - run against typed catalog rows before any DTO projection is hydrated. The unused `TradeMenuDebug` + remaining behavior construction and legacy simulation checks. Hull type, + hardpoint type, shape fit, station bay fit, hull/category, and behavior-kind + prefilters now run against typed catalog rows before any DTO projection is hydrated. The unused `TradeMenuDebug` script has been deleted instead of preserving an old uGUI debug path that turned typed trade rows back into legacy `ItemData` objects. That hydration now comes from typed state, not `AetherDB.msgpack`. @@ -394,8 +394,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. metadata. Item properties manufacturer display is a typed snapshot consumer; loadout generation is the remaining runtime single-ID item projection bridge, but typed catalog rows own - the loadout candidate prefilters for shape, category, hardpoint type, and - behavior kind before that bridge is invoked. The old trade debug UI + the loadout candidate prefilters for hull type, shape, category, hardpoint + type, and behavior kind before that bridge is invoked. The old trade debug UI and console `give` command have been deleted. No live caller can enumerate legacy catalog entries or request catalog-shaped single entries through `ItemManager`. @@ -566,6 +566,8 @@ First Aetheria surfaces to publish: behavior-kind prefilters ahead of DTO hydration so typed catalog rows reject incompatible candidates before `GetRuntimeItemProjection` is called. + - Done: move loadout hull type and control-module behavior-kind checks onto + typed catalog rows before hydrating `HullData`/`BehaviorData` projections. - Done: delete unused `TradeMenuDebug`; the old debug uGUI trade path no longer hydrates typed trade rows back into legacy `ItemData` objects. - Done: delete the console `give` command instead of preserving a debug