57 lines
2.3 KiB
C#
57 lines
2.3 KiB
C#
namespace AcDream.Core.Physics.Motion;
|
|
|
|
/// <summary>
|
|
/// R5 — port of retail's <c>TargettedVoyeurInfo</c> (acclient.h:52807,
|
|
/// struct #5801). One entry in a <see cref="TargetManager"/>'s voyeur table:
|
|
/// a subscriber watching THIS object, the send-on-move <see cref="Radius"/>
|
|
/// threshold it registered, its dead-reckoning <see cref="Quantum"/>, and the
|
|
/// <see cref="LastSentPosition"/> already delivered to it (the delta baseline
|
|
/// <c>CheckAndUpdateVoyeur</c> compares against). Mutable class (retail heap
|
|
/// record updated in place by <c>AddVoyeur</c>/<c>SendVoyeurUpdate</c>).
|
|
/// </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; }
|
|
|
|
/// <summary>+0x04 retail <c>quantum</c> — the subscriber's dead-reckoning
|
|
/// lookahead horizon (seconds).</summary>
|
|
public double Quantum { get; set; }
|
|
|
|
/// <summary>+0x10 retail <c>radius</c> — the send-on-move threshold: an
|
|
/// update is pushed only when the tracked object drifts more than this from
|
|
/// <see cref="LastSentPosition"/>.</summary>
|
|
public float Radius { get; set; }
|
|
|
|
/// <summary>+0x14 retail <c>last_sent_position</c> — the position last
|
|
/// delivered to this subscriber (updated by <c>SendVoyeurUpdate</c>).</summary>
|
|
public Position LastSentPosition { get; set; }
|
|
|
|
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;
|
|
}
|
|
}
|