Pin the departure gate's strictness with a light exactly at the threshold
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
53ff5f7c01
commit
ddbd120af0
1 changed files with 29 additions and 0 deletions
|
|
@ -644,6 +644,35 @@ public sealed class ContactRevealTests : IDisposable
|
|||
Assert.Equal(ended ? 0 : 1, o.RevealsOf(e).Count());
|
||||
}
|
||||
|
||||
// The gate is strict, as the light-act gate is: a light at removal that lands exactly on the threshold ends nothing.
|
||||
// The signature is searched, a few floats either side of threshold over info, for the one whose product with the
|
||||
// observer's info on the spot is exactly the threshold.
|
||||
[Fact]
|
||||
public void ADepartureExactlyAtTheLightActGateEndsNothing()
|
||||
{
|
||||
var e = Add(float3(0, 0, 100), new[] { "Gun" });
|
||||
var o = Add(float3(0, 0, 0), new[] { "Eye" });
|
||||
Fire(e, Guns(e)[0]);
|
||||
Tick(.01f);
|
||||
Assert.Single(o.RevealsOf(e));
|
||||
var threshold = _items.GameplaySettings.TargetDetectionInfoThreshold;
|
||||
var info = o.PassiveInfo(e.Position.xz, 1f);
|
||||
var signature = threshold / info;
|
||||
for (var step = 0; step < 8 && signature * info != threshold; step++)
|
||||
signature = BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(signature) + 1);
|
||||
if (signature * info != threshold) signature = threshold / info;
|
||||
for (var step = 0; step < 16 && signature * info != threshold; step++)
|
||||
signature = BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(signature) - 1);
|
||||
Assert.True(signature * info == threshold, "fixture: a light exactly at the gate exists");
|
||||
ShowOnly(e, signature, Guns(e)[0]);
|
||||
Assert.True(e.Visibility * info == threshold, "fixture: the ship's light at removal is exactly the gate");
|
||||
|
||||
_zone.Entities.Remove(e);
|
||||
Tick(.1f);
|
||||
|
||||
Assert.Single(o.RevealsOf(e));
|
||||
}
|
||||
|
||||
// A signature on the Emission channel (paint strength, a ping) is not light: it does not make a departure seen.
|
||||
[Fact]
|
||||
public void AnEmissionSignatureDoesNotMakeADepartureSeen()
|
||||
|
|
|
|||
Loading…
Reference in a new issue