Ship S2 fixes: structural anchors are not mounts, mod presets refused, one bad mod never bricks the boot

- Validate: a hardpoint's anchor role is fixed by its type (thruster-emitter, radiator-mesh, else articulation); ShipModPlan's
  duplicate role check is deleted.
- Loadouts.Commit refuses a preset naming a mod design (mod-hull:/mod-ship:), so the shipped catalog never references a mod.
- Compose quarantines each package: a bad package is excluded and named, a collision excludes every package involved; the
  game boots on the rest (or the shipped catalog) and the main menu lists the exclusions.
- RequireDesigns refuses a save with a null item or lot instead of throwing NullReferenceException.
- Tests: per structural role, muzzle id ties, every slot/zone/lot in RequireDesigns, listing order, exclusion cases.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 08:30:52 +02:00
commit 54917bb39d
13 changed files with 408 additions and 92 deletions

View file

@ -59,13 +59,26 @@ public sealed class ShipModPlanTests
// A thruster-emitter anchor on a weapon mount, and a radiator-mesh anchor that is no mount at all.
var ship = Rig();
ship.Visual.Anchors.Single(anchor => anchor.Id == "gun").Role = "thruster-emitter";
Assert.Contains("thruster-emitter anchor gun must be a Thruster hardpoint's mount", Refusal(ship));
Assert.Contains("Energy hardpoint gun needs a articulation anchor of that id", Refusal(ship));
ship = Rig();
ship.Visual.Anchors.Add(new ShipAnchor { Id = "loose", Role = "radiator-mesh", ModelNodeId = "loose" });
Assert.Contains("radiator-mesh anchor loose must be a Radiator hardpoint's mount", Refusal(ship));
}
// Equal Order falls back to the id, compared ordinally, whatever order the anchors were authored in.
[Fact]
public void MuzzlesOfEqualOrderAreTiedByIdOrdinally()
{
var ship = Rig();
ship.Visual.Anchors.RemoveAll(anchor => anchor.Role == "weapon-muzzle");
foreach (var id in new[] { "gun.c", "gun.a", "gun.B", "gun.b" })
ship.Visual.Anchors.Add(new ShipAnchor { Id = id, Role = "weapon-muzzle", ModelNodeId = id, ParentId = "gun", Order = 2 });
ship.Visual.Anchors.Add(new ShipAnchor { Id = "gun.z", Role = "weapon-muzzle", ModelNodeId = "gun.z", ParentId = "gun", Order = 1 });
Assert.Equal(new[] { "gun.z", "gun.B", "gun.a", "gun.b", "gun.c" }, Assert.Single(Plan(ship).Weapons).Muzzles);
}
[Fact]
public void MuzzlesBelongToWeaponMountsAndEveryWeaponHasOne()
{