acdream/src/AcDream.App/Physics/LiveEntityShadowPublisher.cs
Erik f961d70023 feat(physics): port retail complete object frame pipeline
Restore the named-retail object update order across local, remote, static, projectile, animation, shadow, teleport, and effect lifetimes. Separate authoritative root commits from spatial rebucketing, preserve per-owner hook/FIFO ordering, and remove update-path allocations with exact lifecycle and residency gates.

Add deterministic conformance, adversarial lifetime, GUID-reuse, pending-cell, quaternion, timestamp, and allocation coverage. Release build is warning-free and all 6,446 tests pass with five intentional skips; retail, architecture, and adversarial reviews are clean.

Co-authored-by: OpenAI Codex <codex@openai.com>
2026-07-20 09:10:31 +02:00

56 lines
1.7 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,
ILiveEntityRemoteMotionRuntime 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,
ILiveEntityRemoteMotionRuntime remote,
ulong positionAuthorityVersion) =>
(record.FinalPhysicsState & PhysicsStateFlags.Hidden) == 0
&& ReferenceEquals(record.WorldEntity, entity)
&& runtime.IsCurrentPositionAuthority(record, positionAuthorityVersion)
&& runtime.IsCurrentSpatialRemoteMotion(record, remote);
}