ConsumablesFirstSetTests: fit the first radiator pairing that the hull takes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-10 06:37:38 +02:00
commit d577c64d8f

View file

@ -126,14 +126,19 @@ public sealed class ConsumablesFirstSetTests
Ship = RestoredHullsTests.BuildThrustedShip(Cache, "Djinni");
Zone = Ship.Zone;
var hull = Cache.GetByName<HullData>("Djinni");
var hardpoint = hull.Hardpoints.First(h => h.Type == HardpointType.Radiator);
var design = Cache.GetAll<GearData>().First(g => hardpoint.IsFilledBy(g) && g.Behaviors.OfType<RadiatorData>().Any());
var item = new EquippableItem
{
Data = Cache.RefOf<ItemData>(design), Durability = design.Durability,
Lot = Ship.ItemManager.Lots.Add(new Lot { Design = Cache.RefOf<ItemData>(design), Origin = new Attributed(), Quality = .5f, Roles = new List<RoleFill>() })
};
Assert.True(Ship.TryEquip(item, hardpoint.Position));
// The first radiator hardpoint that takes a radiator design; a hull has several and not every pairing fits.
var fitted = false;
foreach (var hardpoint in hull.Hardpoints.Where(h => h.Type == HardpointType.Radiator).TakeWhile(_ => !fitted))
foreach (var design in Cache.GetAll<GearData>().Where(g => hardpoint.IsFilledBy(g) && g.Behaviors.OfType<RadiatorData>().Any()))
{
var item = new EquippableItem
{
Data = Cache.RefOf<ItemData>(design), Durability = design.Durability,
Lot = Ship.ItemManager.Lots.Add(new Lot { Design = Cache.RefOf<ItemData>(design), Origin = new Attributed(), Quality = .5f, Roles = new List<RoleFill>() })
};
if (fitted = Ship.TryEquip(item, hardpoint.Position)) break;
}
Assert.True(fitted, "no radiator fits the Djinni");
Zone.Update(0f);
}