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:
parent
b45c6cab35
commit
d577c64d8f
1 changed files with 13 additions and 8 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue