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 <noreply@anthropic.com>
This commit is contained in:
parent
178db6be32
commit
c59ff26b54
3 changed files with 71 additions and 2 deletions
BIN
GameData/Aetheria.cc
(Stored with Git LFS)
BIN
GameData/Aetheria.cc
(Stored with Git LFS)
Binary file not shown.
68
tools/AetherDb/HardpointRotationCommand.cs
Normal file
68
tools/AetherDb/HardpointRotationCommand.cs
Normal file
|
|
@ -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 "<hull>" <x>,<y> <None|CounterClockwise|Reversed|Clockwise> [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 \"<hull>\" <x>,<y> <None|CounterClockwise|Reversed|Clockwise> [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<ItemRotation>(positional[2], out var rotation) || !Enum.IsDefined(typeof(ItemRotation), rotation))
|
||||
{
|
||||
output.WriteLine(Usage);
|
||||
return 1;
|
||||
}
|
||||
var hulls = cache.GetAll<HullData>().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<EquippableItemData>().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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <name> <hull product> [<x>,<y>,<rotation>,<design>[@<product>]]... [--group <i>,<j>...]... [--replace] [--boss-of <faction>], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective <fraction>] [--end <multiplier>], 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 \"<name>\" <kind>] [apply], economy report|prices|author <batch>... [apply]|balance");
|
||||
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, hardpoint-rotation \"<hull>\" <x>,<y> <rotation> [apply], loadout [seed], loadout-commit <name> <hull product> [<x>,<y>,<rotation>,<design>[@<product>]]... [--group <i>,<j>...]... [--replace] [--boss-of <faction>], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective <fraction>] [--end <multiplier>], 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 \"<name>\" <kind>] [apply], economy report|prices|author <batch>... [apply]|balance");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue