refactor(world): extract live entity hydration
This commit is contained in:
parent
27dcd0ecb7
commit
d10c5f2d54
17 changed files with 4310 additions and 1269 deletions
|
|
@ -36,7 +36,7 @@ public sealed class EquippedChildRenderController : IDisposable
|
|||
private ParentAttachmentState Relations => _liveEntities.ParentAttachments;
|
||||
|
||||
/// <summary>Raised after the attached projection is fully registered.</summary>
|
||||
public event Action<uint>? EntityReady;
|
||||
internal event Action<LiveEntityReadyCandidate>? EntityReady;
|
||||
/// <summary>Raised after an attached projection has its composed pose.</summary>
|
||||
public event Action<uint>? ProjectionPoseReady;
|
||||
/// <summary>Raised when an attached projection leaves its cell presentation.</summary>
|
||||
|
|
@ -448,14 +448,46 @@ public sealed class EquippedChildRenderController : IDisposable
|
|||
// CPhysicsObj::set_hidden (0x00514C60).
|
||||
_liveEntities.SetAttachedChildNoDraw(childGuid, noDraw: true);
|
||||
}
|
||||
ulong readyCreateIntegrationVersion = childRecord.CreateIntegrationVersion;
|
||||
PublishChildPose(entity, parentWorld, parentEntity.ParentCellId, pose);
|
||||
Console.WriteLine(
|
||||
$"equipment: attached child=0x{childGuid:X8} parent=0x{pending.ParentGuid:X8} " +
|
||||
$"location={parentLocation} placement={placement}");
|
||||
Relations.MarkProjected(pending, candidateKind);
|
||||
ProjectionPoseReady?.Invoke(childGuid);
|
||||
EntityReady?.Invoke(childGuid);
|
||||
return true;
|
||||
return PublishEntityReadyExact(
|
||||
_liveEntities,
|
||||
childRecord,
|
||||
readyCreateIntegrationVersion,
|
||||
entity,
|
||||
EntityReady);
|
||||
}
|
||||
|
||||
internal static bool PublishEntityReadyExact(
|
||||
LiveEntityRuntime runtime,
|
||||
LiveEntityRecord expectedRecord,
|
||||
ulong expectedCreateIntegrationVersion,
|
||||
WorldEntity expectedEntity,
|
||||
Action<LiveEntityReadyCandidate>? publish)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(runtime);
|
||||
ArgumentNullException.ThrowIfNull(expectedRecord);
|
||||
ArgumentNullException.ThrowIfNull(expectedEntity);
|
||||
if (!runtime.IsCurrentCreateIntegration(
|
||||
expectedRecord,
|
||||
expectedCreateIntegrationVersion)
|
||||
|| !ReferenceEquals(expectedRecord.WorldEntity, expectedEntity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
publish?.Invoke(new LiveEntityReadyCandidate(
|
||||
expectedRecord,
|
||||
expectedCreateIntegrationVersion));
|
||||
return runtime.IsCurrentCreateIntegration(
|
||||
expectedRecord,
|
||||
expectedCreateIntegrationVersion)
|
||||
&& ReferenceEquals(expectedRecord.WorldEntity, expectedEntity);
|
||||
}
|
||||
|
||||
private void PublishChildPose(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue