ship-authoring starter: a complete flyable package for authors with no Blender
Writes <mods>/<id>/ship.cc and ship.glb: a shipped hull's stats, a 4x6 grid with two drives, a radiator, two energy guns and the internal modules, and a boxed model carrying every anchor. The package is read back through ShipModCatalog.ReadPackage, so the GLB's node ids and mesh roles are judged by the reader the game boots with. Refuses to overwrite a package. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
17c19521f5
commit
5b4665dfbb
3 changed files with 240 additions and 0 deletions
|
|
@ -501,6 +501,28 @@ public sealed class ShipModCatalogTests : IDisposable
|
|||
Assert.True(File.Exists(target), error);
|
||||
}
|
||||
|
||||
// starter: a complete package from nothing but a hull to take stats from. The package must pass the reader the game boots
|
||||
// with (GLB node ids and mesh roles included) and plan a rig, and a second run must not touch the first package.
|
||||
[Fact]
|
||||
public void StarterWritesAPackageTheGameLoadsAndPlansARigFrom()
|
||||
{
|
||||
var like = new HullData { Name = "Like", HullType = HullType.Ship, Mass = 1234, Behaviors = { new VelocityLimitData() } };
|
||||
var mods = Path.Combine(_directory.Path, "GameData", "Mods");
|
||||
var path = ShipStarterCommand.Write(mods, "probe.starter", "Probe Starter", like);
|
||||
|
||||
var package = ShipModCatalog.ReadPackage(path);
|
||||
Assert.Equal(("Probe Starter", 1234f), (package.Hull.Name, package.Hull.Mass));
|
||||
var plan = ShipModPlan.Build(package.Hull, package.Visual);
|
||||
Assert.Equal(2, plan.Thrusters.Length);
|
||||
Assert.Single(plan.Radiators);
|
||||
Assert.Equal(new[] { 1, 1 }, plan.Weapons.Select(weapon => weapon.Muzzles.Length));
|
||||
Assert.Equal(package.Hull.Shape.Width * package.Hull.Shape.Height, package.Hull.Shape.Cells.Cast<bool>().Count(cell => cell));
|
||||
|
||||
var before = File.ReadAllBytes(path);
|
||||
Assert.Throws<InvalidOperationException>(() => ShipStarterCommand.Write(mods, "probe.starter", "Other", like));
|
||||
Assert.Equal(before, File.ReadAllBytes(path));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CentreCommandPrintsShapeCenterOfMass()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue