refactor(world): canonicalize live physics host ownership

This commit is contained in:
Erik 2026-07-21 14:05:34 +02:00
parent 5882b308c1
commit fcb66198fc
21 changed files with 1546 additions and 323 deletions

View file

@ -11,6 +11,14 @@ namespace AcDream.Core.Physics.Motion;
/// </summary>
public sealed class TargettedVoyeurInfo
{
/// <summary>
/// Exact watcher incarnation captured when this subscription is created.
/// Retail object IDs are process-lifetime object-table identities; the App
/// preserves that pointer-like identity explicitly while an old
/// INSTANCE_TS teardown may overlap a newer record with the same GUID.
/// </summary>
internal IPhysicsObjHost WatcherHost { get; }
/// <summary>+0x00 retail <c>object_id</c> — the subscriber's guid.</summary>
public uint ObjectId { get; }
@ -27,10 +35,23 @@ public sealed class TargettedVoyeurInfo
/// delivered to this subscriber (updated by <c>SendVoyeurUpdate</c>).</summary>
public Position LastSentPosition { get; set; }
public TargettedVoyeurInfo(uint objectId, float radius, double quantum)
public TargettedVoyeurInfo(
uint objectId,
float radius,
double quantum,
IPhysicsObjHost watcherHost)
{
ArgumentNullException.ThrowIfNull(watcherHost);
if (watcherHost.Id != objectId)
{
throw new ArgumentException(
"Watcher identity must match the voyeur object ID.",
nameof(watcherHost));
}
ObjectId = objectId;
Radius = radius;
Quantum = quantum;
WatcherHost = watcherHost;
}
}