From c59ff26b540190ecfb19c6103590a8853fb3c2bf Mon Sep 17 00:00:00 2001 From: soul Date: Fri, 27 Nov 2026 17:17:43 +0100 Subject: [PATCH] hardpoint-rotation: the Zenith's fourth radiator mount takes radiators again Zenith (11,6) was rotation None, so no 4x1 or 2x1 radiator lay in its 1x4 cells; its twin at (11,2) is Clockwise. Applied once: hardpoint-rotation "Zenith" 11,6 Clockwise apply. Co-Authored-By: Claude Sonnet 5.5 --- GameData/Aetheria.cc | 2 +- tools/AetherDb/HardpointRotationCommand.cs | 68 ++++++++++++++++++++++ tools/AetherDb/Program.cs | 3 +- 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 tools/AetherDb/HardpointRotationCommand.cs diff --git a/GameData/Aetheria.cc b/GameData/Aetheria.cc index 4c4e607a4..d2984a5da 100644 --- a/GameData/Aetheria.cc +++ b/GameData/Aetheria.cc @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:589e6db0ee98b9a43b963725164832b0421e07bcb2de56a5ab8f3878c3ea5343 +oid sha256:d5793d085bb41d856ff79aa579d4bd00a2d337da38b2e7e953cc5a7337710ac8 size 274284 diff --git a/tools/AetherDb/HardpointRotationCommand.cs b/tools/AetherDb/HardpointRotationCommand.cs new file mode 100644 index 000000000..daf32df62 --- /dev/null +++ b/tools/AetherDb/HardpointRotationCommand.cs @@ -0,0 +1,68 @@ +using System; +using System.IO; +using System.Linq; +using GameCult.Caching; + +// Sets one hardpoint's rotation on one catalog hull: hardpoint-rotation "" , [apply]. +// The hull is named exactly once in the catalog and the hardpoint is the one at that position, or nothing is touched. It prints +// the designs that Take the mount before and after (HardpointData.Takes, the one fit rule). Dry run unless apply; a rotation +// the mount already has writes nothing. +public static class HardpointRotationCommand +{ + public const string Usage = "hardpoint-rotation \"\" , [apply]"; + + public static int Run(string[] args) + { + var apply = args.Contains("apply"); + var positional = args.Where(a => a != "apply").ToArray(); + using var db = AetherDb.Open(catalogWritable: apply); + var code = Run(db.Cache, positional, apply, Console.Out); + if (apply && code == 0) db.Cache.FlushAsync().GetAwaiter().GetResult(); + return code; + } + + public static int Run(CultCache cache, string[] positional, bool apply, TextWriter output) + { + var coordinates = positional.Length == 3 ? positional[1].Split(',') : null; + if (coordinates == null || coordinates.Length != 2 || !int.TryParse(coordinates[0], out var x) || !int.TryParse(coordinates[1], out var y) + || !Enum.TryParse(positional[2], out var rotation) || !Enum.IsDefined(typeof(ItemRotation), rotation)) + { + output.WriteLine(Usage); + return 1; + } + var hulls = cache.GetAll().Where(h => h.Name == positional[0]).ToArray(); + if (hulls.Length != 1) + { + output.WriteLine($"The catalog holds {hulls.Length} hulls named '{positional[0]}'; exactly one is required."); + return 1; + } + var hull = hulls[0]; + var mounts = hull.Hardpoints.Where(h => h.Position.x == x && h.Position.y == y).ToArray(); + if (mounts.Length != 1) + { + output.WriteLine($"{hull.Name} has {mounts.Length} hardpoints at ({x},{y}); exactly one is required."); + return 1; + } + var mount = mounts[0]; + var designs = cache.GetAll().ToArray(); + string Takers() => string.Join(", ", designs.Where(mount.Takes).Select(d => d.Name).OrderBy(n => n, StringComparer.Ordinal)); + var before = mount.Rotation; + output.WriteLine($"{hull.Name} ({x},{y}) {mount.Type} {mount.Shape.Width}x{mount.Shape.Height}: rotation {before} [{Takers()}]"); + if (before == rotation) + { + output.WriteLine("No change."); + return 0; + } + mount.Rotation = rotation; + output.WriteLine($"{hull.Name} ({x},{y}) {mount.Type} {mount.Shape.Width}x{mount.Shape.Height}: rotation {rotation} [{Takers()}]"); + if (!apply) + { + mount.Rotation = before; + output.WriteLine("\nDry run. Pass \"apply\" to set it."); + return 0; + } + cache.Upsert(hull); + output.WriteLine($"\nSet {hull.Name}'s hardpoint ({x},{y}) rotation in Aetheria.cc"); + return 0; + } +} diff --git a/tools/AetherDb/Program.cs b/tools/AetherDb/Program.cs index ea3cb80c1..8d6cadb81 100644 --- a/tools/AetherDb/Program.cs +++ b/tools/AetherDb/Program.cs @@ -25,6 +25,7 @@ public static class Program case "census": return Census(); case "station-fit": return StationFit(); case "hardpoint-fit": return HardpointFit(); + case "hardpoint-rotation": return HardpointRotationCommand.Run(args.Skip(1).ToArray()); case "loadout": return Loadout(args.Skip(1).ToArray()); case "loadout-commit": return LoadoutCommitCommand.Run(args.Skip(1).ToArray()); case "save": return Save(); @@ -81,7 +82,7 @@ public static class Program case "auto-guns": return AutoGunsCatalog.Run(AetherDb.Open(catalogWritable: args.Contains("apply")).Cache, args.Contains("apply"), Console.Out); case "doctrine-catalog": return DoctrineCatalog.Run(AetherDb.Open(catalogWritable: args.Contains("apply")).Cache, args.Contains("apply"), Console.Out); default: - Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], loadout-commit [,,,[@]]... [--group ,...]... [--replace] [--boss-of ], save, settings, settings-dump, dangling [clear ]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective ] [--end ], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], place-names [apply], product-lines weapons|minor-powers|gear|tiers [apply], doctrine-catalog [apply], auto-guns [apply], assembly-from-maker [apply], station-kinds [hull \"\" ] [apply], economy report|prices|author ... [apply]|balance"); + Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, hardpoint-rotation \"\" , [apply], loadout [seed], loadout-commit [,,,[@]]... [--group ,...]... [--replace] [--boss-of ], save, settings, settings-dump, dangling [clear ]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective ] [--end ], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], place-names [apply], product-lines weapons|minor-powers|gear|tiers [apply], doctrine-catalog [apply], auto-guns [apply], assembly-from-maker [apply], station-kinds [hull \"\" ] [apply], economy report|prices|author ... [apply]|balance"); return 1; } }