View seam tests: per-shooter aim, view gates, sees-hostile, honest track loss (red)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-22 18:21:12 +02:00
commit c40a6e8229
4 changed files with 171 additions and 7 deletions

View file

@ -9,14 +9,14 @@ using float3 = CultMath.float3;
// track from the first step, and the pilot follows it only as long as the sensors keep it.
public sealed partial class RunStartTests
{
private (Zone arena, Ship east, Ship west) StagedApproach()
private (Zone arena, Ship east, Ship west) StagedApproach(float westX = -450f)
{
Ship east = null, west = null;
var (_, arena, _, failures) = Launch(new Scripted(false, stage =>
{
stage.Player(stage.Bare("Djinni"), float2(-50000, -50000));
east = stage.Place(EvLonginus(stage), float2(450, 0), facing: float2(-1, 0), piloted: true) as Ship;
west = stage.Place(EvLonginus(stage), float2(-450, 0), facing: float2(1, 0), piloted: true) as Ship;
west = stage.Place(EvLonginus(stage), float2(westX, 0), facing: float2(1, 0), piloted: true) as Ship;
stage.Approach(east, west);
}));
Assert.True(failures.Count == 0, string.Join("; ", failures));
@ -39,22 +39,27 @@ public sealed partial class RunStartTests
Assert.True(east.Position.x - west.Position.x < startGap - 20f, "the follower closed on its anchor");
}
// The anchor is staged 60 km off, far outside sensor reach: the staged knowledge decays through the sensors like any
// track (the Sensor is the only writer after staging), and the follower stops once they have dropped it. Nothing
// here writes the pilot's knowledge after the stage.
[Fact]
public void AStagedApproachFollowerStopsFollowingOnceTheSensorsLoseTheTrack()
{
var (arena, east, west) = StagedApproach();
var (arena, east, west) = StagedApproach(westX: -60000f);
var view = arena.Agents.Single(a => a.Ship == east).View;
var sentinel = new float3(0, 0, 12345);
for (var i = 0; i < 3; i++) arena.Update(1f / 60f);
Assert.NotNull(view.TrackOf(east, PilotView.Handle(west)));
east.Command.Aim = sentinel;
arena.Update(1f / 60f);
arena.Update(.1f);
Assert.NotEqual(sentinel, east.Command.Aim.Value);
east.EntityInfoGathered[west] = 0f;
var steps = 0;
while (view.TrackOf(east, PilotView.Handle(west)) != null && steps++ < 1200) arena.Update(.1f);
Assert.Null(view.TrackOf(east, PilotView.Handle(west)));
east.Command.Aim = sentinel;
arena.Update(1f / 60f);
arena.Update(.1f);
Assert.Equal(sentinel, east.Command.Aim.Value);
}
}