Lock warning: a painted ship owns a typed incoming-lock warning carrying the lock's strength

LockWeapon.Execute paints its target with its own Lock (the one value the outgoing indicator also reads);
Entity publishes the one-tick inbox as IncomingLocks; the HUD shows one incoming indicator on the strongest
warning with the outgoing indicator's curves. Unity HUD code not compiled here; tests not yet run at this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-10 19:25:22 +02:00
commit e5cfc0d676
4 changed files with 320 additions and 0 deletions

View file

@ -173,6 +173,12 @@ public abstract class Entity
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 lock warning comes only from a paint. LockWeapon.Execute
// reports each tick it paints this ship into the inbox; Update publishes the inbox once, so a warning lives
// exactly one tick after its last paint.
private readonly List<LockWarning> _paintInbox = new List<LockWarning>();
private readonly List<LockWarning> _incomingLocks = new List<LockWarning>();
public IReadOnlyList<LockWarning> IncomingLocks => _incomingLocks;
public ReactiveProperty<SecurityLevel> CurrentSecurityLevel = new ReactiveProperty<SecurityLevel>(SecurityLevel.Open);
public ReadOnlyReactiveProperty<bool> PresencePermitted;
@ -783,6 +789,15 @@ public abstract class Entity
VisibleEntities.Clear();
VisibleEnemies.Clear();
VisibleFriendlies.Clear();
_paintInbox.Clear();
_incomingLocks.Clear();
}
// The only caller is LockWeapon.Execute; strength is the emitter's own Lock at that paint.
internal void ReceivePaint(float3 emitterPosition, EquippableItemData emitterClass, float strength)
{
if (!_active) return;
_paintInbox.Add(new LockWarning(normalize((emitterPosition - Position).xz), emitterClass, strength));
}
public Entity(ItemManager itemManager, Zone zone, EquippableItem hull, EntitySettings settings)
@ -1378,6 +1393,10 @@ public abstract class Entity
TurnRate = 0;
if (!_active) return;
_incomingLocks.Clear();
_incomingLocks.AddRange(_paintInbox);
_paintInbox.Clear();
var velocityBefore = Velocity;
LimitClamp = float2(0, 0);
var hullData = ItemManager.GetData(Hull) as HullData;