From 098598974456d01f1df28f8d150a8e241f31b977 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 12 Oct 2026 04:02:32 +0200 Subject: [PATCH] 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 --- .../Weapons/GuidedProjectileManager.cs | 12 ++-- .../ServerShared/Behaviors/Launcher.cs | 18 +----- tools/AetherDb/Program.cs | 63 +------------------ 3 files changed, 9 insertions(+), 84 deletions(-) diff --git a/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs b/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs index 876dda1f6..b325b4fd8 100644 --- a/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs @@ -44,7 +44,7 @@ public class GuidedProjectileManager : InstantWeaponEffectManager p.SourceEntity = source.Entity; if (target != null) p.Target = target.transform; else p.TargetPosition = () => burst; - p.Frequency = launcher.DodgeFrequency; + p.Frequency = item.Evaluate(MunitionParts.Of(item).EvasionFrequency); var hp = item.Hardpoint; var barrel = source.GetBarrel(hp); p.StartPosition = (p.transform.position = barrel.position).ToCultMath(); @@ -53,8 +53,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager p.LiftCurve = launcher.LiftCurve.ToCurve(); p.ThrustCurve = launcher.ThrustCurve.ToCurve(); p.Velocity = barrel.forward * weapon.Velocity; - p.Thrust = item.Evaluate(launcher.Thrust); - p.TopSpeed = item.Evaluate(launcher.MissileVelocity); + p.Thrust = item.Evaluate(MunitionParts.Of(item).Acceleration); + p.TopSpeed = item.Evaluate(MunitionParts.Of(item).MaxSpeed); Bind(p, source.Entity.Zone, shotId); // A round with no target (a fused round fired at none) has no transform to hand a listener. OnFireGuided.OnNext((source.Entity, target != null ? target.transform : null, p)); @@ -65,7 +65,7 @@ public class GuidedProjectileManager : InstantWeaponEffectManager p.ShotId = shotId; p.Source = source.transform; p.SourceEntity = source.Entity; - p.Frequency = guidance.DodgeFrequency; + p.Frequency = item.Evaluate(MunitionParts.Of(item).EvasionFrequency); var hp = item.Hardpoint; var barrel = source.GetBarrel(hp); p.StartPosition = (p.transform.position = barrel.position).ToCultMath(); @@ -74,8 +74,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager p.LiftCurve = guidance.LiftCurve.ToCurve(); p.ThrustCurve = guidance.ThrustCurve.ToCurve(); p.Velocity = barrel.forward * weapon.Velocity; - p.Thrust = item.Evaluate(guidance.Thrust); - p.TopSpeed = item.Evaluate(guidance.MissileVelocity); + p.Thrust = item.Evaluate(MunitionParts.Of(item).Acceleration); + p.TopSpeed = item.Evaluate(MunitionParts.Of(item).MaxSpeed); p.TargetPosition = () => (source.Entity.Position + length(source.LookAtPoint.position.ToCultMath() - source.Entity.Position) * source.Entity.Aim).ToUnity(); Bind(p, source.Entity.Zone, shotId); } diff --git a/Assets/Scripts/ServerShared/Behaviors/Launcher.cs b/Assets/Scripts/ServerShared/Behaviors/Launcher.cs index e443bdf1d..439394df0 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Launcher.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Launcher.cs @@ -18,14 +18,7 @@ public class LauncherData : LockWeaponData [InspectableAnimationCurve, JsonProperty("liftCurve"), Key(28)] public float4[] LiftCurve; - [Inspectable, JsonProperty("thrust"), Key(29)] - public PerformanceStat Thrust = new PerformanceStat(); - - [Inspectable, JsonProperty("frequency"), Key(30)] - public float DodgeFrequency; - - [Inspectable, JsonProperty("missileSpeed"), Key(31), RuntimeInspectable] - public PerformanceStat MissileVelocity = new PerformanceStat(); + // Keys 29-31 were Thrust, DodgeFrequency and MissileVelocity, retired for the munition parts (MunitionParts.cs); do not reuse. public override Behavior CreateInstance(EquippedItem item) { @@ -45,14 +38,7 @@ public class GuidedWeaponData : InstantWeaponData [InspectableAnimationCurve, JsonProperty("liftCurve"), Key(23)] public float4[] LiftCurve; - [Inspectable, JsonProperty("thrust"), Key(24)] - public PerformanceStat Thrust = new PerformanceStat(); - - [Inspectable, JsonProperty("frequency"), Key(25)] - public float DodgeFrequency; - - [Inspectable, JsonProperty("missileSpeed"), Key(26), RuntimeInspectable] - public PerformanceStat MissileVelocity = new PerformanceStat(); + // Keys 24-26 were Thrust, DodgeFrequency and MissileVelocity, retired for the munition parts (MunitionParts.cs); do not reuse. public override Behavior CreateInstance(EquippedItem item) { diff --git a/tools/AetherDb/Program.cs b/tools/AetherDb/Program.cs index 2a1e9188b..ee928bcae 100644 --- a/tools/AetherDb/Program.cs +++ b/tools/AetherDb/Program.cs @@ -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 ]... [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 ]... [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()).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() }; - - 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().OrderBy(d => d.Name, StringComparer.Ordinal)) - { - var launcher = (design.Behaviors ?? new List()).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; - } }