From 16293d95a0704816733b66c3b18dea46f6f46ee0 Mon Sep 17 00:00:00 2001 From: soul Date: Sat, 28 Nov 2026 03:22:09 +0100 Subject: [PATCH] Arsenal Depot takes a Facility row; the station room census ship-authoring push gives the depot one 2x2 Facility row, Fa.1 at (4,2), clear of every other row. StationFacilityRoomTests judges the booted catalog: every offered station hull takes the facilities of every kind it serves (with a positive control that names a rowless Zenith) and keeps room for the Medium Docking Bay and a heater with every hardpoint's cells taken. Co-Authored-By: Claude Sonnet 5.5 --- GameData/Mods/aetheria.arsenal-depot/ship.cc | 4 +- .../StationFacilityRoomTests.cs | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs diff --git a/GameData/Mods/aetheria.arsenal-depot/ship.cc b/GameData/Mods/aetheria.arsenal-depot/ship.cc index 009fcc535..949c10991 100644 --- a/GameData/Mods/aetheria.arsenal-depot/ship.cc +++ b/GameData/Mods/aetheria.arsenal-depot/ship.cc @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38ef4bd42c471cafc58f288bc34624ce4d50e032bd61149aea23d870a0ff626b -size 16269 +oid sha256:39161fd005235347759ea079c962e4749b3c5c81410c83b1f871f9de5d08bfe3 +size 16300 diff --git a/tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs b/tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs new file mode 100644 index 000000000..3c02ddfc7 --- /dev/null +++ b/tests/Aetheria.Shared.Tests/StationFacilityRoomTests.cs @@ -0,0 +1,61 @@ +using System.Linq; +using CultMath; +using Xunit; + +// Station facilities on typed mounts (aetheria-living-world, cut recipe-facilities; ruling station-facilities-on-typed-mounts): over +// the catalog the game boots, every offered station hull has the Facility rows to take the facility gear of every kind it serves, +// and keeps room for the docking bay and the heater it has always carried. +public sealed class StationFacilityRoomTests +{ + // StationKinds.FacilityRoomFaults over the booted catalog (shipped hulls and station packages): empty. A package merged without + // its Facility row, or a kind given a facility some hull serving it cannot take, fails here by name. + [Fact] + public void EveryServedKindFitsItsHulls() + { + using var cache = RestoredHullsTests.OpenCatalog(); + Assert.Empty(StationKinds.FacilityRoomFaults(cache)); + } + + // Positive control: Zenith's Facility rows taken away (in memory, on a read-only catalog), the census names the hull, a kind it + // serves and that kind's facility. + [Fact] + public void ARowlessHullIsNamed() + { + using var cache = RestoredHullsTests.OpenCatalog(); + var zenith = Assert.Single(cache.GetAll(), hull => hull.Name == "Zenith"); + Assert.Contains(zenith.Hardpoints, row => row.Type == HardpointType.Facility); + zenith.Hardpoints.RemoveAll(row => row.Type == HardpointType.Facility); + var faults = StationKinds.FacilityRoomFaults(cache); + Assert.Contains(faults, line => line.Contains("Zenith") && line.Contains("Mining Station") && line.Contains("Extraction Rig")); + Assert.All(faults, line => Assert.Contains("Zenith", line)); + } + + // A Facility row must not crowd out what a station has always carried: with every hardpoint's cells taken, each booted station + // hull's interior still fits the Medium Docking Bay and then a heater. + [Fact] + public void EveryStationHullKeepsRoomForDockAndHeater() + { + using var cache = RestoredHullsTests.OpenCatalog(); + var bay = Assert.Single(cache.GetAll(), design => design.Name == "Medium Docking Bay"); + var heater = cache.GetAll().Where(LoadoutGenerator.IsHeater) + .OrderBy(design => design.Shape.Coordinates.Length).ThenBy(design => design.Name, System.StringComparer.Ordinal).First(); + var hulls = cache.GetAll().Where(hull => hull.HullType == HullType.Station).ToArray(); + Assert.NotEmpty(hulls); + foreach (var hull in hulls) + { + var free = new Shape(hull.Shape.Width, hull.Shape.Height); + foreach (var cell in hull.InteriorCells.Coordinates) free[cell] = true; + foreach (var row in hull.Hardpoints) + foreach (var cell in row.Shape.Coordinates) + { + var taken = row.Position + cell; + if (taken.x >= 0 && taken.y >= 0 && taken.x < free.Width && taken.y < free.Height) free[taken] = false; + } + foreach (var design in new ItemData[] { bay, heater }) + { + Assert.True(design.Shape.FitsWithin(free, out var rotation, out var position), $"{hull.Name}: no room left for {design.Name} with every hardpoint's cells taken."); + foreach (var cell in design.Shape.Coordinates) free[design.Shape.Rotate(cell, rotation) + position] = false; + } + } + } +}