Retire the launcher flight fields; the presenter reads the munition parts; the migrate command goes

Thrust, DodgeFrequency and MissileVelocity are gone from LauncherData (keys 29-31) and GuidedWeaponData (keys 24-26), keys
reserved. GuidedProjectileManager flies the round from MunitionParts.Of: Acceleration, MaxSpeed and EvasionFrequency,
evaluated through the item. munition-parts-migrate is deleted with the fields it read.

The shipped catalog still carries the dead keys in this commit; the next commit re-saves it. The Unity assembly was not compiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-12 04:02:32 +02:00
commit 0985989744
3 changed files with 9 additions and 84 deletions

View file

@ -49,9 +49,8 @@ public static class Program
Console.OutputEncoding = new System.Text.UTF8Encoding(false);
return PiratesFaction(args.Contains("apply"));
case "verse-grammar": return VerseGrammarCommand.Run(args.Contains("apply"));
case "munition-parts-migrate": return MunitionPartsMigrate(args.Contains("apply"));
default:
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], pirates-faction [apply], verse-grammar [apply], munition-parts-migrate [apply]");
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], pirates-faction [apply], verse-grammar [apply]");
return 1;
}
}
@ -2159,64 +2158,4 @@ public static class Program
return 0;
}
// Aetheria release, cut missile-stats (ruling missile-stats-now-gear-later): a launcher design's flight stats move off
// LauncherData and GuidedWeaponData onto five munition part behaviours at the launcher's Group. One-shot: it reads the three
// fields the same commit's second half deletes, and goes with them. Copied with their terms and role: Acceleration from
// Thrust, MaxSpeed from MissileVelocity, Lateral from Thrust at half Min and Max; EvasionFrequency is DodgeFrequency, flat.
// Everything else is authored flat from the design (Sensitivity and Visibility are placeholders the records cut calibrates).
// Dry run unless passed "apply"; a design that already carries its parts is left alone.
private static int MunitionPartsMigrate(bool apply)
{
// Opened without AetherDb.Open's validation: the catalog this command repairs fails ValidateMunitionParts until it runs.
var cache = new CultCache();
cache.AddBackingStore(new SingleFileMessagePackBackingStore(Path.Combine(AetherDb.FindRoot(), "GameData", "Aetheria.cc"), !apply), AetheriaStores.CatalogTypes);
PerformanceStat Copy(PerformanceStat stat, float scale = 1f) => new PerformanceStat
{
Min = stat.Min * scale, Max = stat.Max * scale,
Terms = (stat.Terms ?? new List<StatTerm>()).Select(t => new StatTerm { Source = t.Source, Exponent = t.Exponent, Role = t.Role }).ToList(),
};
PerformanceStat Flat(float value) => new PerformanceStat { Min = value, Max = value, Terms = new List<StatTerm>() };
var changed = new List<(EquippableItemData Document, CultRecordKey Key)>();
Console.WriteLine($"{"design",-22} {"data",-17} {"Thrust",-12} {"MissileVelocity",-12} {"Dodge",6} {"Range",-12} parts");
foreach (var design in cache.GetAll<EquippableItemData>().OrderBy(d => d.Name, StringComparer.Ordinal))
{
var launcher = (design.Behaviors ?? new List<BehaviorData>()).FirstOrDefault(b => b is LauncherData || b is GuidedWeaponData);
if (launcher == null) continue;
var (thrust, speed, dodge) = launcher is LauncherData l
? (l.Thrust, l.MissileVelocity, l.DodgeFrequency)
: (((GuidedWeaponData) launcher).Thrust, ((GuidedWeaponData) launcher).MissileVelocity, ((GuidedWeaponData) launcher).DodgeFrequency);
var range = ((WeaponData) launcher).Range;
Console.WriteLine($"{design.Name,-22} {launcher.GetType().Name,-17} {thrust.Min,5:0.##}-{thrust.Max,-6:0.##} {speed.Min,5:0.##}-{speed.Max,-6:0.##} {dodge,6:0.##} {range.Min,5:0.##}-{range.Max,-6:0.##} " +
string.Join(",", design.Behaviors.Where(b => b is MunitionPartData).Select(b => b.GetType().Name)));
if (design.Behaviors.Any(b => b is MunitionPartData)) continue;
var maxSpeed = Copy(speed);
var cognition = design.Name == "LRMM72" || design.Name == "SRMM72" ? 0.25f : 0.5f;
var group = launcher.Group;
design.Behaviors.Add(new MunitionHullData { Group = group, Durability = Flat(20f), Radius = Flat(4f) });
design.Behaviors.Add(new MunitionThrusterData { Group = group, Acceleration = Copy(thrust), Lateral = Copy(thrust, 0.5f), MaxSpeed = maxSpeed, Visibility = Flat(10f) });
design.Behaviors.Add(new MunitionSeekerData { Group = group, Sensitivity = Flat(0.75f), BeamWidth = Flat(60f), Range = Flat(0.3f * range.Max) });
design.Behaviors.Add(new MunitionControlData
{
Group = group, Navigation = Flat(3f), Evasion = Flat(0.5f), EvasionFrequency = Flat(dodge),
Lifetime = Flat(1.5f * range.Max / maxSpeed.Max), Cognition = Flat(cognition),
});
design.Behaviors.Add(new MunitionFuelData { Group = group, DeltaV = Flat(2f * maxSpeed.Max) });
changed.Add((design, cache.RefOf(design).Key));
}
Console.WriteLine($"\n{changed.Count} design(s) to migrate.");
if (!apply)
{
Console.WriteLine("Dry run. Pass \"apply\" to land them.");
return 0;
}
foreach (var (document, _) in changed) CultRecordRefs.Validate(document);
cache.Commit(batch =>
{
foreach (var (document, key) in changed) batch.Upsert(document is WeaponItemData ? typeof(WeaponItemData) : typeof(GearData), document, key);
});
Console.WriteLine($"Landed {changed.Count} design(s) in Aetheria.cc");
return 0;
}
}