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:
Meta Vens 2026-10-13 07:13:55 +02:00
commit 4708a71a67
10 changed files with 149 additions and 57 deletions

View file

@ -192,9 +192,7 @@ public abstract class Entity
public Subject<Unit> HeatstrokeDeath = new Subject<Unit>();
public Subject<Unit> HypothermiaRisk = new Subject<Unit>();
public Subject<Unit> HypothermiaDeath = new Subject<Unit>();
public Subject<Entity> TargetedBy = new Subject<Entity>();
public ReactiveProperty<int> TargetedByCount = new ReactiveProperty<int>(0);
// TargetedBy counts selection, which emits nothing; a warning comes only from a paint. A search paint is a ping
// Selection tells the selected ship nothing: a warning comes only from a paint. A search paint is a ping
// sweeping this ship (Sensor.Execute); a track paint is a lock (LockWeapon.Execute). Each reports into the
// inbox the tick it paints; PublishInbox publishes the inbox once, so a warning lives exactly one tick after
// its last paint.
@ -308,13 +306,6 @@ public abstract class Entity
{
if (Target.Value.Entity == remove.Value) SetTarget(TargetRef.None);
}));
// Only an entity is ever targeted by: a chunk has no one to tell.
_subscriptions.Add(Target.Subscribe(target => target.Entity?.TargetedBy.OnNext(this)));
_subscriptions.Add(TargetedBy.Subscribe(enemy =>
{
TargetedByCount.Value++;
enemy.Target.Where(t => t.Entity != this).Take(1).Subscribe(_ => TargetedByCount.Value--);
}));
//
_subscriptions.Add(EntityInfoGathered.ObserveReplace().Subscribe(replace =>
@ -947,6 +938,10 @@ public abstract class Entity
if (book.Count == 0) _reveals.Remove(subject);
}
// The subjects this observer holds any reveal of, departed ones included until the prune: with VisibleEntities, every
// contact it has (ContactOf is Detected for a tracked subject or one with a young reveal).
public IReadOnlyCollection<Entity> RevealedSubjects => _reveals.Keys;
// What this observer has seen `subject`'s items do: each item's latest act, and nothing the subject's present
// gear or Durability says (ruling contact-reads-book-aim-reads-live). A reveal ends only on what this observer
// perceives (ruling reveal-ends-on-perception): the destruction of an item of a ship it identifies, the death,