Munition parts: five gear-part behaviours carry a missile type's stats; completeness gate; one-shot migrate command
MunitionHullData, MunitionThrusterData, MunitionSeekerData, MunitionControlData (with Cognition) and MunitionFuelData (Behaviors union 43-47), read through MunitionParts.Of. StatValidation.ValidateMunitionParts refuses a launcher design without exactly one of each and any other design carrying one, at catalog load and Upsert. AetherDb gains munition-parts-migrate; LauncherRoles names the part's thruster stats by type and field (Range and Visibility also name the seeker's and plume's flat stats, which RolesBackfill must not range). Does not pass tests on its own: the shipped catalog is migrated in the next commit, and until then it fails the new gate at load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
730a4e5a52
commit
3c1e1e7421
7 changed files with 443 additions and 4 deletions
|
|
@ -815,6 +815,23 @@ public static class StatValidation
|
|||
}
|
||||
}
|
||||
|
||||
// Ruling missile-stats-now-gear-later: a munition design (a LauncherData or GuidedWeaponData behaviour) carries exactly
|
||||
// one of each of the five munition parts, and any other design carries none. Runs wherever ValidateStatModifiers runs,
|
||||
// so a launcher missing a part is named at catalog load and Upsert rather than at its first launch.
|
||||
public static void ValidateMunitionParts(string ownerName, IEnumerable<BehaviorData> behaviors)
|
||||
{
|
||||
var all = (behaviors ?? Enumerable.Empty<BehaviorData>()).Where(b => b != null).ToArray();
|
||||
var isMunition = all.Any(b => b is LauncherData || b is GuidedWeaponData);
|
||||
foreach (var part in new[] { typeof(MunitionHullData), typeof(MunitionThrusterData), typeof(MunitionSeekerData), typeof(MunitionControlData), typeof(MunitionFuelData) })
|
||||
{
|
||||
var count = all.Count(b => b.GetType() == part);
|
||||
var expected = isMunition ? 1 : 0;
|
||||
if (count != expected)
|
||||
throw new InvalidOperationException(
|
||||
$"{ownerName}: carries {count} {part.Name}, but a {(isMunition ? "munition" : "non-munition")} design carries {expected}");
|
||||
}
|
||||
}
|
||||
|
||||
// Cut 7 (docs/stats-and-power-cut.md): "a stat naming a role its design lacks" must be refused, not silently
|
||||
// fall back to the lot's own workmanship (Lot.QualityForRole already falls back for a role a lot never rolled
|
||||
// -- that is the intended forward-compat path for an old lot meeting a newly-authored role. This is the other
|
||||
|
|
|
|||
Loading…
Reference in a new issue