Pin the mount aim's resolved reads, the record's isolation and its Deactivate clear; delete two dead guards

Forecast and Fire drop a mount aim whose gate closed (destroyed, unidentified); a record for one Bay never hides another's mount; Deactivate clears the record. Deleted: the located-or-booked guard in RecordSeenDestroyed and the Entity == subject check in ResolvedAim (the record is read only for layout mounts; a Target change already clears the slot). Comments name AimedAt. Not built or run yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-15 07:14:35 +02:00
commit a54e2f53df
5 changed files with 81 additions and 9 deletions

View file

@ -289,6 +289,40 @@ public sealed partial class ContactRevealTests
Assert.Equal(3f, sil.AimPoint.y, 4);
}
// ---- AMountAimThatLostItsGateDropsOutOfForecastAndFire ----
// The aim slot holds the mount, but what prices and freezes a shot is the aim as it resolves now: a mount the observer has
// since seen destroyed, or whose hull it no longer identifies, is no aim. The forecast prices the unaimed hull and the
// shot is fired aimed at nothing, though nothing wrote the slot at the moment the gate closed.
[Theory]
[InlineData("destroyed")]
[InlineData("unidentified")]
public void AMountAimThatLostItsGateDropsOutOfForecastAndFire(string how)
{
var (shooter, bay, reactor, weapon, gun) = Gunner();
var aimedPrice = FireControl.Inspect(weapon, shooter, bay).POnHull;
shooter.TrySelectTargetItem(null);
var unaimedPrice = FireControl.Inspect(weapon, shooter, bay).POnHull;
Assert.True(Math.Abs(aimedPrice - unaimedPrice) > 1e-3f, "fixture: the mount aim and no aim are priced apart");
Assert.True(shooter.TrySelectMount(reactor.Hardpoint), "fixture: the mount is aimed at again");
if (how == "destroyed")
{
reactor.EquippableItem.Durability = 0f;
SenseOf(shooter)();
}
else
{
shooter.EntityInfoGathered[bay] = Identify - .01f;
}
Assert.True(shooter.ResolvedAim.Mount == null, "fixture: the aim no longer resolves");
if (how == "destroyed")
Assert.Equal(unaimedPrice, FireControl.Inspect(weapon, shooter, bay).POnHull, 4);
var shot = FireAt(weapon, gun, shooter);
Assert.True(shot.AimedMount == null && shot.Aimed == null, "the shot is aimed at nothing");
}
// ---- TheShotKeepsTheAimItWasFiredWith ----
[Fact]

View file

@ -217,4 +217,43 @@ public sealed partial class ContactRevealTests
Assert.True(SameMounts(honest.HullData.Hardpoints.ToArray(), MountsOf(observer.AimCycle(liar))), "no claimed mount is recorded destroyed");
}
// ---- TheRecordIsPerSubject ----
// Two ships of one hull share their HardpointData. The reactor seen destroyed on one Bay leaves that Bay's cycle and no
// other: the observer's memory is of the ship it saw, not of the mount.
[Fact]
public void TheRecordIsPerSubject()
{
var (bayA, observer, reactorA) = Identified();
var bayB = AddBay(float3(100, 0, 100));
observer.EntityInfoGathered[bayB] = 1f;
var reactorB = Fitted(bayB, "BayReactor");
Assert.True(ReferenceEquals(reactorA.Hardpoint, reactorB.Hardpoint), "fixture: the two Bays share their mount objects");
reactorA.EquippableItem.Durability = 0f;
SenseOf(observer)();
Assert.False(MountsOf(observer.AimCycle(bayA)).Any(m => ReferenceEquals(m, reactorA.Hardpoint)), "fixture: seen destroyed on A");
Assert.True(MountsOf(observer.AimCycle(bayB)).Any(m => ReferenceEquals(m, reactorB.Hardpoint)), "B's reactor mount stays in B's cycle");
Target(observer, bayB);
Assert.True(observer.TrySelectMount(reactorB.Hardpoint), "and can be aimed at on B");
}
// ---- DeactivateClearsTheRecord ----
// A ship that warps out forgets what it saw: its fresh book no longer supports the record, so the mount seen destroyed
// is back in the cycle.
[Fact]
public void DeactivateClearsTheRecord()
{
var (bay, observer, reactor) = Identified();
reactor.EquippableItem.Durability = 0f;
SenseOf(observer)();
Assert.False(MountsOf(observer.AimCycle(bay)).Any(m => ReferenceEquals(m, reactor.Hardpoint)), "fixture: recorded");
observer.Deactivate();
observer.EntityInfoGathered[bay] = 1f;
Assert.True(MountsOf(observer.AimCycle(bay)).Any(m => ReferenceEquals(m, reactor.Hardpoint)), "the record went with the observer's memory");
}
}