Aetheria/tests/Aetheria.Shared.Tests/ShippedWeaponOperabilityTests.cs
Meta Vens baf90d34c9 Mine Launcher heat in kelvin; every shipped weapon must perform at a hull's starting temperature
AetherDb mine-launcher now corrects an already authored launcher to 173.15..473.15 K (optimum 249.65, plateau 36,
the sibling weapon's) and authors new ones the same way. Entity.StartingCellTemperature names the 280 the hull
cells start at, and ShippedWeaponOperabilityTests reads it against the shipped catalog. The catalog blob follows
in the next commit, so the test is red at this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:04:16 +02:00

22 lines
1 KiB
C#

using System.Linq;
using Xunit;
// A weapon is thermally dead at 0 performance: ThermalOnline is false and wear runs at full rate. Hull cells
// start at Entity.StartingCellTemperature, so every shipped weapon must perform there, or a ship fitted with it
// can never fire it. The catalog comes from the shipped GameData/Aetheria.cc and the temperature from the
// constant Entity builds its cells with, so a unit slip in authoring (celsius for kelvin) fails here.
public sealed class ShippedWeaponOperabilityTests
{
[Fact]
public void EveryShippedWeaponPerformsAtAHullsStartingTemperature()
{
using var cache = RestoredHullsTests.OpenCatalog();
var weapons = cache.GetAll<GearData>().OfType<WeaponItemData>().ToArray();
Assert.NotEmpty(weapons);
var dead = weapons.Where(weapon => weapon.Performance(Entity.StartingCellTemperature) <= 0f)
.Select(weapon => $"{weapon.Name} ({weapon.MinimumTemperature}..{weapon.MaximumTemperature} K)").ToArray();
Assert.Empty(dead);
}
}