refactor(runtime): close simulation ownership
Move remote-motion construction, CreateObject vector initialization, final simulation-component retirement, and the combined J5 ownership ledger into Runtime. Delete App compatibility views and moved-state reconstruction while preserving the existing graphical projection and retail update order.
This commit is contained in:
parent
c30a3efeb0
commit
cdee7a4b49
57 changed files with 1013 additions and 410 deletions
|
|
@ -32,7 +32,29 @@ public readonly record struct RuntimeEntityObjectOwnershipSnapshot(
|
|||
bool HasLastStreamDispatchFailure,
|
||||
int PendingDispatchCount,
|
||||
bool IsDispatching,
|
||||
bool IsSessionClearInProgress);
|
||||
bool IsSessionClearInProgress,
|
||||
bool IsDisposed)
|
||||
{
|
||||
public bool IsConverged =>
|
||||
IsDisposed
|
||||
&& ActiveEntityCount == 0
|
||||
&& TeardownEntityCount == 0
|
||||
&& ClaimedLocalIdCount == 0
|
||||
&& AcceptedSnapshotCount == 0
|
||||
&& UnresolvedParentRelationCount == 0
|
||||
&& StagedParentRelationCount == 0
|
||||
&& RecoveryParentRelationCount == 0
|
||||
&& CommittedParentRelationCount == 0
|
||||
&& ObjectCount == 0
|
||||
&& ContainerCount == 0
|
||||
&& ContainerProjectionCount == 0
|
||||
&& EquipmentOwnerCount == 0
|
||||
&& PendingMoveCount == 0
|
||||
&& StreamSubscriberCount == 0
|
||||
&& PendingDispatchCount == 0
|
||||
&& !IsDispatching
|
||||
&& !IsSessionClearInProgress;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One exact DeleteObject acceptance issued by a
|
||||
|
|
@ -140,7 +162,8 @@ public sealed class RuntimeEntityObjectLifetime : IDisposable
|
|||
Events.LastDispatchFailure is not null,
|
||||
Events.PendingDispatchCount,
|
||||
Events.IsDispatching,
|
||||
_sessionClearInProgress);
|
||||
_sessionClearInProgress,
|
||||
_disposed);
|
||||
}
|
||||
|
||||
public void BindEventContext(
|
||||
|
|
@ -355,17 +378,7 @@ public sealed class RuntimeEntityObjectLifetime : IDisposable
|
|||
Entities.RetainTeardown(canonical);
|
||||
try
|
||||
{
|
||||
Physics.RemoveSpatialProjection(canonical);
|
||||
Entities.SetRemoteMotion(canonical, null);
|
||||
Entities.SetRemoteMotionBindingInProgress(canonical, false);
|
||||
Entities.SetProjectile(canonical, null);
|
||||
Entities.SetProjectileBindingInProgress(canonical, false);
|
||||
Entities.SetRequiresRemotePlacementRuntime(canonical, false);
|
||||
Entities.SetPhysicsHost(canonical, null);
|
||||
Entities.SetPhysicsBody(canonical, null);
|
||||
Entities.SetPhysicsBodyAcquisitionInProgress(canonical, false);
|
||||
Entities.SetHasPartArray(canonical, false);
|
||||
Entities.ReleaseLocalId(canonical);
|
||||
CompleteProjectionRetirement(canonical);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -379,6 +392,30 @@ public sealed class RuntimeEntityObjectLifetime : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Completes the presentation acknowledgement for one retained
|
||||
/// incarnation. Runtime retires every presentation-independent component
|
||||
/// and releases its local identity only after the graphical host has
|
||||
/// finished using those exact components for ExitWorld teardown.
|
||||
/// </summary>
|
||||
internal void CompleteProjectionRetirement(
|
||||
RuntimeEntityRecord canonical)
|
||||
{
|
||||
EnsureNotDisposed();
|
||||
ArgumentNullException.ThrowIfNull(canonical);
|
||||
Physics.RemoveSpatialProjection(canonical);
|
||||
Entities.SetRemoteMotion(canonical, null);
|
||||
Entities.SetRemoteMotionBindingInProgress(canonical, false);
|
||||
Entities.SetProjectile(canonical, null);
|
||||
Entities.SetProjectileBindingInProgress(canonical, false);
|
||||
Entities.SetRequiresRemotePlacementRuntime(canonical, false);
|
||||
Entities.SetPhysicsHost(canonical, null);
|
||||
Entities.SetPhysicsBody(canonical, null);
|
||||
Entities.SetPhysicsBodyAcquisitionInProgress(canonical, false);
|
||||
Entities.SetHasPartArray(canonical, false);
|
||||
Entities.ReleaseLocalId(canonical);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the retained-object half of an accepted CreateObject while the
|
||||
/// exact canonical incarnation and its integration version remain current.
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ internal sealed class RuntimeEntityObjectViews
|
|||
: IRuntimeEntityView
|
||||
{
|
||||
public int Count => owner.Count;
|
||||
public int MaterializedCount => owner.ClaimedLocalIdCount;
|
||||
|
||||
public bool TryGet(
|
||||
uint serverGuid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue