using AcDream.App.World; using AcDream.Core.Physics; using AcDream.Core.World; namespace AcDream.App.Physics; /// Synchronizes a resolved remote placement in the current live origin. internal sealed class RemoteShadowPlacementSynchronizer { private readonly RemotePhysicsUpdater _remotePhysics; private readonly LiveWorldOriginState _origin; public RemoteShadowPlacementSynchronizer( RemotePhysicsUpdater remotePhysics, LiveWorldOriginState origin) { _remotePhysics = remotePhysics ?? throw new ArgumentNullException(nameof(remotePhysics)); _origin = origin ?? throw new ArgumentNullException(nameof(origin)); } public void Sync(WorldEntity entity, PhysicsBody body, uint cellId) => _remotePhysics.SyncRemoteShadowToBody( entity.Id, body, _origin.CenterX, _origin.CenterY, cellId); } /// Bridges remote placement ownership to live presentation state. internal sealed class RemoteTeleportPlacementPresentation { private readonly LiveEntityPresentationController _presentation; public RemoteTeleportPlacementPresentation( LiveEntityPresentationController presentation) => _presentation = presentation ?? throw new ArgumentNullException(nameof(presentation)); public void Complete(uint serverGuid, ushort generation, bool deferShadowRestore) => _presentation.CompleteAuthoritativePlacement( serverGuid, generation, deferShadowRestore); public void Begin(uint serverGuid, ushort generation) => _presentation.BeginAuthoritativePlacement(serverGuid, generation); }