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.
56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using AcDream.App.World;
|
|
using AcDream.Core.Physics;
|
|
using AcDream.Core.World;
|
|
|
|
namespace AcDream.App.Physics;
|
|
|
|
/// <summary>
|
|
/// Incarnation/residency gate for authoritative ordinary-remote collision
|
|
/// publication after a canonical rebucket callback.
|
|
/// </summary>
|
|
internal static class LiveEntityShadowPublisher
|
|
{
|
|
internal static bool TryPublishRemote(
|
|
LiveEntityRuntime runtime,
|
|
LiveEntityRecord record,
|
|
WorldEntity entity,
|
|
IRuntimeRemoteMotion remote,
|
|
ulong positionAuthorityVersion,
|
|
Action publish)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(runtime);
|
|
ArgumentNullException.ThrowIfNull(record);
|
|
ArgumentNullException.ThrowIfNull(entity);
|
|
ArgumentNullException.ThrowIfNull(remote);
|
|
ArgumentNullException.ThrowIfNull(publish);
|
|
|
|
if (!CanPublish(
|
|
runtime,
|
|
record,
|
|
entity,
|
|
remote,
|
|
positionAuthorityVersion))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
publish();
|
|
return CanPublish(
|
|
runtime,
|
|
record,
|
|
entity,
|
|
remote,
|
|
positionAuthorityVersion);
|
|
}
|
|
|
|
private static bool CanPublish(
|
|
LiveEntityRuntime runtime,
|
|
LiveEntityRecord record,
|
|
WorldEntity entity,
|
|
IRuntimeRemoteMotion remote,
|
|
ulong positionAuthorityVersion) =>
|
|
(record.FinalPhysicsState & PhysicsStateFlags.Hidden) == 0
|
|
&& ReferenceEquals(record.WorldEntity, entity)
|
|
&& runtime.IsCurrentPositionAuthority(record, positionAuthorityVersion)
|
|
&& runtime.IsCurrentSpatialRemoteMotion(record, remote);
|
|
}
|