diff --git a/Assets/Scripts/ServerShared/Scenarios/LockOn.cs b/Assets/Scripts/ServerShared/Scenarios/LockOn.cs index 87e5de829..7dc850497 100644 --- a/Assets/Scripts/ServerShared/Scenarios/LockOn.cs +++ b/Assets/Scripts/ServerShared/Scenarios/LockOn.cs @@ -12,9 +12,9 @@ public sealed class LockOn : Scenario // The hostile starts about 4000 m off, ahead and to port of the player, facing the player. At that range its passive // sensors hold no track of the player (the test asks the sim's own PassiveInfo against the detection threshold). The - // hostile closes, sees the player some fourteen seconds in and locks. The zone's pull bends the hostile's run and moves the - // player, and the warning must still point at where the hostile was staged to within 5 degrees at the lock: this side keeps - // the bend under one degree (on the far side it is more than seven). At Duel's 900 m (and at 600 m) it sees and locks + // hostile closes, sees the player some fourteen seconds in and locks. Its flanking approach and the zone's pull carry it + // off the staged line (about 5 degrees by the lock on the merged tree), and the warning must point at where the hostile + // is at the lock, which the test checks against the live bearing. At Duel's 900 m (and at 600 m) it sees and locks // within a second. public static readonly CultMath.float2 HostileAt = float2(-2000, 3450); diff --git a/tests/Aetheria.Shared.Tests/LockOnScenarioTests.cs b/tests/Aetheria.Shared.Tests/LockOnScenarioTests.cs index 5c0632787..0e326d7b0 100644 --- a/tests/Aetheria.Shared.Tests/LockOnScenarioTests.cs +++ b/tests/Aetheria.Shared.Tests/LockOnScenarioTests.cs @@ -35,6 +35,7 @@ public sealed partial class RunStartTests var lockedAt = -1; var bearingDot = 0f; + var stagedDrift = 0f; var strengths = new List(); for (var tick = 0; tick < 600 && (lockedAt < 0 || tick < lockedAt + 40); tick++) { @@ -44,13 +45,16 @@ public sealed partial class RunStartTests if (lockedAt < 0) { lockedAt = tick; - bearingDot = dot(normalize(paint.Bearing), toPlayer * -1f); + // The warning points at the hostile where it is at the lock; the hostile has left the staged line by then. + var live = normalize(hostile.Position.xz - player.Position.xz); + bearingDot = dot(normalize(paint.Bearing), live); + stagedDrift = degrees(acos(clamp(dot(live, -toPlayer), -1f, 1f))); } strengths.Add(paint.Strength); } } Assert.True(lockedAt >= 0, "the hostile never locked the player within 600 ticks of .1 s"); - Assert.True(bearingDot >= cos(radians(5f)), "the warning points at the hostile"); + Assert.True(bearingDot >= cos(radians(.5f)), $"the warning points at the hostile where it is (the hostile is {stagedDrift} deg off its staged line at the lock)"); Assert.True(strengths.First() < strengths.Last(), $"the lock tightens: Strength went {strengths.First()} to {strengths.Last()}"); } }