Package recentres on the grid's centre of mass and generates map icon, shield, tractor; no collider

AetherDb ship-authoring centre prints Shape.CenterOfMass; Package asks it and moves Ship Root so that point sits
at the world origin, after regenerating the unowned map icon, shield and tractor from the render meshes (Keep
leaves one alone). Package never makes a hull collider (ruling package-frame-defer-collider). smoke_package's
bound-collection rollback cases now rebind to a different path so a rollback that restores keys but not values fails.

C# not yet built when committed; the Blender smokes and Python unit tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-10 21:02:22 +02:00
commit 8d9acf269d
7 changed files with 360 additions and 31 deletions

View file

@ -452,6 +452,27 @@ public sealed class ShipModCatalogTests : IDisposable
Assert.True(File.Exists(target), error);
}
[Fact]
public void CentreCommandPrintsShapeCenterOfMass()
{
// An L: its centre of mass (1.2, 0.2) is not the bounds centre (1.5, 0.5).
var shape = new Shape(4, 2);
foreach (var (x, y) in new[] { (0, 0), (1, 0), (2, 0), (3, 0), (0, 1) }) shape.Cells[x, y] = true;
var target = Path.Combine(_directory.Path, "GameData", "Mods", "probe.l", "ship.cc");
Assert.Equal(0, Run("create", target, "probe.l", "Probe L").Code);
var (hull, ship) = ShipAuthoringStore.Load(target);
hull.Shape = shape;
using (var cache = ShipAuthoringStore.Open(target, writable: true))
{
ShipAuthoringStore.Write(cache, hull, ship);
cache.FlushAsync().Wait();
}
var (code, output, error) = Run("centre", target);
Assert.Equal(0, code);
Assert.Equal("1.2 0.2", output.Trim());
Assert.Equal("", error);
}
private static (int Code, string Output, string Error) Run(params string[] args)
{
var (output, error) = (new StringWriter(), new StringWriter());