Prefilter loadout hull roles with typed catalog
This commit is contained in:
parent
1806ba221e
commit
05c3e88b10
3 changed files with 23 additions and 8 deletions
Binary file not shown.
|
|
@ -128,9 +128,10 @@ public class LoadoutGenerator
|
|||
|
||||
public HullData RandomHull(HullType type, Predicate<HullData> hullFilter = null)
|
||||
{
|
||||
return RandomItem<HullData>(0, item =>
|
||||
return RandomItem<HullData>(0, item =>
|
||||
(hullFilter?.Invoke(item) ?? true) &&
|
||||
item.HullType == type);
|
||||
item.HullType == type,
|
||||
item => string.Equals(item.HullType, type.ToString(), StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
public T[] RandomItems<T>(
|
||||
|
|
@ -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<GearData>(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;
|
||||
|
|
|
|||
|
|
@ -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<T>` 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue