ShipRigTests: the bind tests ride a thruster on the arm without nesting the gun, and every shipped hull that names a rig passes the judge
Builds (tests only; production unchanged since 27ecd1f9).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
941a934ab6
commit
cf981a2cf3
1 changed files with 19 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using CultMath;
|
||||
using GameCult.Caching;
|
||||
using GameCult.Caching.MessagePack;
|
||||
using MessagePack;
|
||||
using Xunit;
|
||||
|
|
@ -312,6 +313,8 @@ public sealed class ShipRigTests : IDisposable
|
|||
{
|
||||
var thruster = ship.Hull.Hardpoints.Single(hardpoint => hardpoint.Transform == "thruster.port");
|
||||
thruster.FiringArc = 90;
|
||||
// The gun leaves the wrist: the arm has one actuator, and the wrist is only a link in its chain.
|
||||
ship.Visual.Anchors.Single(anchor => anchor.Id == "gun").Joint = null;
|
||||
ship.Visual.Anchors.Single(anchor => anchor.Id == "thruster.port").Joint = "arm";
|
||||
}, Reparent("thruster-port", "arm")));
|
||||
Assert.Equal("arm", package.Visual.Anchors.Single(anchor => anchor.Id == "thruster.port").Joint);
|
||||
|
|
@ -328,6 +331,7 @@ public sealed class ShipRigTests : IDisposable
|
|||
BindRefusal(Package(ship =>
|
||||
{
|
||||
ship.Hull.Hardpoints.Single(hardpoint => hardpoint.Transform == "thruster.port").FiringArc = 90;
|
||||
ship.Visual.Anchors.Single(anchor => anchor.Id == "gun").Joint = null;
|
||||
ship.Visual.Anchors.Single(anchor => anchor.Id == "thruster.port").Joint = "arm";
|
||||
})));
|
||||
}
|
||||
|
|
@ -795,6 +799,21 @@ public sealed class ShipRigTests : IDisposable
|
|||
guns.Validate();
|
||||
}
|
||||
|
||||
// Shipped hulls name a Unity prefab, not a rig, so the shipped catalog may hold none that rides a joint; every hull that does
|
||||
// name a visual record must pass the judge, and the count of those is what this run actually judged.
|
||||
[Fact]
|
||||
public void EveryShippedHullThatNamesARigPassesTheJudge()
|
||||
{
|
||||
var path = Path.Combine(_directory.Path, "shipped.cc");
|
||||
File.Copy(Path.Combine(RunStartTests.FindRepoRoot(), "GameData", "Aetheria.cc"), path);
|
||||
using var catalog = new CultCache(TestCatalog.Registry());
|
||||
catalog.AddBackingStore(new SingleFileMessagePackBackingStore(path), AetheriaStores.CatalogTypes);
|
||||
var hulls = catalog.GetAll<ItemData>().OfType<HullData>().ToArray();
|
||||
Assert.NotEmpty(hulls);
|
||||
foreach (var hull in hulls.Where(hull => hull.Visual.IsSet()))
|
||||
ShipAuthoringStore.Validate(hull, catalog.Get(hull.Visual));
|
||||
}
|
||||
|
||||
// Row and Slew are persistent: a package or catalog written with them is read by key, so their positions are wire format.
|
||||
[Fact]
|
||||
public void RowAndSlewKeepTheirWirePositions()
|
||||
|
|
|
|||
Loading…
Reference in a new issue