Tests: the lot-derived alpha test equips its lot before the ship deploys
The first commit's test equipped the sensor after Add admitted the ship, and TryEquip refuses on a deployed ship; the lot built through ItemManager now rides Make into the mount. b63cdf5d does not pass that test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b63cdf5d2b
commit
068adf0d95
2 changed files with 7 additions and 4 deletions
|
|
@ -229,9 +229,13 @@ public sealed partial class ContactRevealTests : IDisposable
|
|||
|
||||
private EquippableItem Make(string name) => new EquippableItem
|
||||
{
|
||||
Data = _items.ItemData.RefOf<ItemData>(_items.ItemData.GetByName<ItemData>(name)), Durability = 10, Lot = _nextLot++
|
||||
Data = _items.ItemData.RefOf<ItemData>(_items.ItemData.GetByName<ItemData>(name)), Durability = 10,
|
||||
Lot = _preparedLots.Remove(name, out var prepared) ? prepared : _nextLot++
|
||||
};
|
||||
|
||||
// Lots a test built through the ItemManager for the next mount of that name, ahead of Add (a ship takes no gear once deployed).
|
||||
private readonly Dictionary<string, int> _preparedLots = new Dictionary<string, int>();
|
||||
|
||||
// A ship at `position` with `mounts` on its sensor hardpoints in order, the tools on free cells and a thruster
|
||||
// on the centre column. A ship with a gun also gets the reactor and targeting a gun needs to fire.
|
||||
private Ship Add(float3 position, string[] mounts = null, string[] tools = null, bool thruster = false)
|
||||
|
|
|
|||
|
|
@ -327,9 +327,8 @@ public sealed partial class ContactRevealTests
|
|||
{
|
||||
var lot = _items.CreateLot(_openCache.GetByName<EquippableItemData>("Disciplined"), _maker, .123f);
|
||||
_items.Lots[lot].Roles = new List<RoleFill> { new RoleFill { Role = "emission-discipline", Quality = discipline } };
|
||||
var ship = Add(float3(0, 0, 0), Array.Empty<string>());
|
||||
Assert.True(ship.TryEquip(new EquippableItem { Data = _items.ItemData.RefOf<ItemData>(_items.ItemData.GetByName<ItemData>("Disciplined")), Durability = 10, Lot = lot }, new int2(0, 0)));
|
||||
_zone.Update(0f);
|
||||
_preparedLots["Disciplined"] = lot;
|
||||
var ship = Add(float3(0, 0, 0), new[] { "Disciplined" });
|
||||
|
||||
Assert.Equal(expected, SensorOf(ship).InterceptFactor, 3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue