diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index fe8895e1d..a2fc461ff 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ 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