ship_cc: replace_visual writes ShipAuthoring's model asset and anchors, pinned to the C# keys

MODEL_ASSET_SLOT, ANCHORS_SLOT and ANCHOR_MEMBERS sit beside the other slot constants and ShipSchemaPinTests binds them
to ShipAuthoring's and ShipAnchor's [Key]s. replace_visual carries an anchor's slots past Order by Id, refuses a blank
or duplicate id, a wrong-length row and a changed ship id, and leaves the hull record and the lines alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-03 17:07:10 +02:00
commit aca1d53e6f
3 changed files with 95 additions and 0 deletions

View file

@ -17,6 +17,8 @@ public sealed class ShipSchemaPinTests
private static readonly string Source = File.ReadAllText(Locate("tools", "blender", "aetheria_ships", "ship_cc.py"));
[Theory]
[InlineData("MODEL_ASSET_SLOT", typeof(ShipAuthoring), nameof(ShipAuthoring.ModelAsset))]
[InlineData("ANCHORS_SLOT", typeof(ShipAuthoring), nameof(ShipAuthoring.Anchors))]
[InlineData("SCHEMATIC_LINES_SLOT", typeof(ShipAuthoring), nameof(ShipAuthoring.SchematicLines))]
[InlineData("HULL_SHAPE_SLOT", typeof(HullData), nameof(HullData.Shape))]
[InlineData("HULL_HARDPOINTS_SLOT", typeof(HullData), nameof(HullData.Hardpoints))]
@ -56,6 +58,15 @@ public sealed class ShipSchemaPinTests
Assert.Equal(slot, KeyOf(typeof(HardpointData), members[slot]));
}
[Fact]
public void PythonAnchorMembersAreShipAnchorMembersAtTheirPositions()
{
var members = Strings("ANCHOR_MEMBERS");
Assert.Equal(5, members.Length);
for (var slot = 0; slot < members.Length; slot++)
Assert.Equal(slot, KeyOf(typeof(ShipAnchor), members[slot]));
}
[Fact]
public void PythonEnumNamesAreTheEnumsInValueOrder()
{