Remember a hostile's stance with its sighting; pin the lapse, claim and distance rules

RememberedHostiles read the stance the freshest reveal was made under (Reveal.Hostile, surfaced as Contact.Hostile) instead of IsHostileTo now, so a hostile held by the observer's override keeps its marker and the music after it dies or warps, until the bearing lapses. The departure test no longer re-sets the override. New tests: the Detected clause for an in-zone lapsed hostile, position independence for far hostiles on three sides, a within-category lie in ClaimedClasses, and the stale warning of a docked ship. The HUD no longer collects sweeps for a docked ship, and a sweep flash resets the pooled lock indicator's motion.

Untested here: the Unity-side changes (ActionGameManager) have no headless test and no compile has run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-14 16:12:44 +02:00
commit 2ea329e6f1
5 changed files with 110 additions and 11 deletions

View file

@ -961,7 +961,7 @@ public abstract class Entity
if (!_active || item == null || !Zone.Entities.Contains(subject) || PerceivesDestroyed(subject, item)) return;
if (!_reveals.TryGetValue(subject, out var book))
_reveals[subject] = book = new Dictionary<EquippedItem, Reveal>();
book[item] = new Reveal(item, channel, normalize((subject.Position - Position).xz), Zone.Time, claimed);
book[item] = new Reveal(item, channel, normalize((subject.Position - Position).xz), Zone.Time, claimed, IsHostileTo(subject));
}
// A finished scan (Scanner.Execute; rulings scan-is-an-act, quiet-gear-identifiable-hull-layout-known: quiet gear
@ -1000,8 +1000,10 @@ public abstract class Entity
public IReadOnlyCollection<Entity> RevealedSubjects => _reveals.Keys;
// The hostile subjects this observer holds only by a bearing: revealed, Detected, not Tracked (what bearing markers and
// the music show). Reads the book and ContactOf, never the subject's Position or gear.
public IEnumerable<Entity> RememberedHostiles => RevealedSubjects.Where(s => IsHostileTo(s) && ContactOf(s) is { Detected: true, Tracked: false });
// the music show). Hostile is the stance the freshest reveal was made under (Contact.Hostile), not IsHostileTo now: the
// stance an override gave goes with the subject when it departs, and the marker lasts until the bearing lapses. Reads the
// book and ContactOf, never the subject's Position or gear.
public IEnumerable<Entity> RememberedHostiles => RevealedSubjects.Where(s => ContactOf(s) is { Detected: true, Tracked: false, Hostile: true });
// 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
@ -1065,7 +1067,7 @@ public abstract class Entity
var bearing = tracked ? normalize((subject.Position - Position).xz) : remembered ? freshest.Bearing : default;
var identified = info >= settings.TargetGearInfoThreshold;
// Profile is the one derivation of the hull this observer believes (no stored belief until the judge, ew-masquerade).
return new Contact(detected, tracked, detected && any, identified, bearing, info, identified ? subject.ClaimedHull : null);
return new Contact(detected, tracked, detected && any, identified, bearing, info, identified ? subject.ClaimedHull : null, any && freshest.Hostile);
}
// What this observer's instruments receive of other ships' acts this tick (Zone.Update calls it once, after every

View file

@ -103,7 +103,9 @@ public readonly struct PaintWarning
// replaces the earlier one. Position is never carried: only the track gives it. `Item` stays the true item: it is the
// book's key and what aim reads. `Claimed` is the class the act claimed, and is what every classifying reader reads
// (aetheria-ew, classify-from-belief). A null `Channel` is a reveal by the observer's own scan (Entity.RecordInspection),
// whose `Claimed` is the subject's claim for the item.
// whose `Claimed` is the subject's claim for the item. `Hostile` is the observer's stance toward the subject at that act
// (IsHostileTo then): remembered with the sighting, so a subject that departs and takes the observer's stance for it along
// is still the hostile it was seen to be.
public readonly struct Reveal
{
public readonly EquippedItem Item;
@ -111,9 +113,11 @@ public readonly struct Reveal
public readonly SignatureChannel? Channel;
public readonly float2 Bearing;
public readonly float Time;
public readonly bool Hostile;
public Reveal(EquippedItem item, SignatureChannel? channel, float2 bearing, float time, EquippableItemData claimed)
public Reveal(EquippedItem item, SignatureChannel? channel, float2 bearing, float time, EquippableItemData claimed, bool hostile)
{
Hostile = hostile;
Item = item;
Claimed = claimed;
Channel = channel;
@ -170,7 +174,8 @@ public readonly struct Departure
// membership of VisibleEntities. Classified: detected, with any reveal in the book. Identified: the track has reached
// TargetGearInfoThreshold, and holds a hull belief: Profile, the hull class this observer believes the subject is (null
// below Identified; aetheria-ew, classify-from-belief; seen-through arrives with the judge). Bearing is the true
// bearing while tracked, else the freshest reveal's.
// bearing while tracked, else the freshest reveal's. Hostile: the stance that freshest reveal was made under (false with
// none), the one hostility a remembered contact has once its subject is gone.
public readonly struct Contact
{
public readonly bool Detected;
@ -180,9 +185,11 @@ public readonly struct Contact
public readonly float2 Bearing;
public readonly float Info;
public readonly HullData Profile;
public readonly bool Hostile;
public Contact(bool detected, bool tracked, bool classified, bool identified, float2 bearing, float info, HullData profile)
public Contact(bool detected, bool tracked, bool classified, bool identified, float2 bearing, float info, HullData profile, bool hostile)
{
Hostile = hostile;
Profile = profile;
Detected = detected;
Tracked = tracked;