Ship mounts: anchors only for visible hardpoints, every role rule in Validate

ShipAuthoringStore.Validate now alone decides which hardpoints carry anchors
and which role each plays. A thruster, radiator, energy, ballistic or launcher
hardpoint needs an anchor of its mount id with role thruster-emitter,
radiator-mesh or the new weapon-mount; every other hardpoint is internal and
no anchor may take its id. A mount-role anchor must be a hardpoint's mount, a
muzzle must hang off a weapon mount, and each weapon needs a muzzle; these
checks move out of ShipModPlan.Build, which now only maps a validated pair to
slots and throws nothing itself. 'articulation' stays in the vocabulary for
pivots and is never a mount.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-03 14:39:08 +02:00
commit 976b711905
6 changed files with 171 additions and 123 deletions

View file

@ -34,7 +34,7 @@ public sealed class ShipValidationTests
ship.Hull.Hardpoints[0].Armor = 5;
ship.Hull.Hardpoints[0].FiringArc = 360;
ship.Hull.Hardpoints[0].Type = HardpointType.AetherDrive;
ship.Visual.Anchors.Single(anchor => anchor.Id == "thruster.port").Role = "articulation";
ship.Visual.Anchors.RemoveAll(anchor => anchor.Id == "thruster.port");
ship.Hull.Hardpoints[0].Rotation = ItemRotation.Clockwise;
ship.Validate();
}
@ -128,7 +128,9 @@ public sealed class ShipValidationTests
public void AnAnchorMayNameItsHardpointAsParent()
{
var ship = ShipAuthoringTests.Fixture();
ship.Visual.Anchors.Add(new ShipAnchor { Id = "muzzle", Role = "weapon-muzzle", ModelNodeId = "muzzle", ParentId = "thruster.port" });
ship.Hull.Hardpoints.Add(new HardpointData { Type = HardpointType.Ballistic, Position = new int2(0, 0), Shape = new Shape(), Transform = "gun" });
ship.Visual.Anchors.Add(new ShipAnchor { Id = "gun", Role = "weapon-mount", ModelNodeId = "gun" });
ship.Visual.Anchors.Add(new ShipAnchor { Id = "muzzle", Role = "weapon-muzzle", ModelNodeId = "muzzle", ParentId = "gun" });
ship.Validate();
}