contact-hud: the HUD reads the player's own ContactOf and book; TargetedBy and the spotted blink go
Selection is nothing the selected ship can sense: TargetedBy, TargetedByCount, their subscriptions and the music read of them are deleted. Indicator fills, the target panel, the compass, music and the enemy schematic rows now read CurrentEntity's ContactOf / RevealsOf / RevealedSubjects (new, the book's keys); the schematic rows are built by one builder from the book and rebuilt when the revealed set changes. Impact hull effect and projectile hit effects at another ship's position draw only through ActionGameManager.DrawsAt (the player's own ship or a Tracked contact). Builds untested in Unity at this commit; tests NothingReadsSelection and RevealedSubjectsListsTheBook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6292d82615
commit
4708a71a67
10 changed files with 149 additions and 57 deletions
|
|
@ -1223,6 +1223,62 @@ public sealed partial class ContactRevealTests : IDisposable
|
|||
Assert.Null(PathFrom(o, held));
|
||||
}
|
||||
|
||||
// Cut contact-hud: selection tells the selected ship nothing. A ship that selects another, which is neither painted
|
||||
// by it nor sees it, leaves no fact on the selected one: no paint in its inbox, no contact, no reveal.
|
||||
[Fact]
|
||||
public void NothingReadsSelection()
|
||||
{
|
||||
var selector = Add(float3(0, 0, 200), new[] { "Gun" });
|
||||
var selected = Add(float3(0, 0, 0)); // deaf and unseen: no sensor, nothing it could hear
|
||||
selector.SetTarget(selected);
|
||||
Assert.Same(selected, selector.Target.Value.Entity); // fixture: it is selected
|
||||
|
||||
for (var i = 0; i < 20; i++) Tick(.1f);
|
||||
|
||||
Assert.Empty(selected.IncomingPaints);
|
||||
Assert.False(selected.ContactOf(selector).Detected);
|
||||
Assert.Empty(selected.RevealedSubjects);
|
||||
}
|
||||
|
||||
// The one list of remembered contacts: the subjects whose reveals the observer holds. A tracked subject with no
|
||||
// reveal is not in it; a revealed subject that leaves unseen stays until its bearing is BearingMemory old, then
|
||||
// goes; Deactivate empties it.
|
||||
[Fact]
|
||||
public void RevealedSubjectsListsTheBook()
|
||||
{
|
||||
var e = Add(float3(0, 0, 100), new[] { "Gun" });
|
||||
var tracked = Add(float3(50, 0, 0));
|
||||
var o = Add(float3(0, 0, 0), new[] { "Eye" });
|
||||
var gun = Guns(e)[0];
|
||||
o.EntityInfoGathered[tracked] = 1f;
|
||||
Assert.True(o.ContactOf(tracked).Tracked); // fixture: tracked, no reveal
|
||||
Assert.Empty(o.RevealedSubjects);
|
||||
|
||||
Fire(e, gun);
|
||||
Assert.Same(e, Assert.Single(o.RevealedSubjects));
|
||||
|
||||
var freshest = Freshest(o, e);
|
||||
ShowOnly(e, 1f, gun);
|
||||
Assert.True(e.Visibility * o.PassiveInfo(e.Position.xz, 1f) <= _items.GameplaySettings.TargetDetectionInfoThreshold, "fixture: its last light is below o's gate");
|
||||
_zone.Entities.Remove(e);
|
||||
var memory = _items.GameplaySettings.BearingMemory;
|
||||
var lapsed = false;
|
||||
for (var i = 0; i < 200 && !lapsed; i++)
|
||||
{
|
||||
Tick(.1f);
|
||||
lapsed = _zone.Time - freshest >= memory;
|
||||
Assert.Equal(!lapsed, o.RevealedSubjects.Contains(e)); // exactly while the bearing is remembered
|
||||
}
|
||||
Assert.True(lapsed, "fixture: the bearing lapsed");
|
||||
Assert.Empty(o.RevealedSubjects);
|
||||
|
||||
var q = Add(float3(40, 0, 100), new[] { "Gun" });
|
||||
Fire(q, Guns(q)[0]);
|
||||
Assert.Same(q, Assert.Single(o.RevealedSubjects));
|
||||
o.Deactivate();
|
||||
Assert.Empty(o.RevealedSubjects);
|
||||
}
|
||||
|
||||
// The first field path from `root` to `target`, not entering the zone or the item manager, or null.
|
||||
private static string PathFrom(object root, object target)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue