acdream/src/AcDream.App/Physics/LiveEntityVectorRoute.cs
Erik aa90c64666 refactor(world): extract live entity network updates
Move Position, Vector, State, Movement, and equal-generation CreateObject routing out of GameWindow while preserving per-channel authority, ForcePosition acknowledgement, and motion-runtime ownership. Add adversarial authority and exact-wire coverage so reentrant updates and GUID reuse cannot publish stale state.
2026-07-21 19:11:49 +02:00

34 lines
1 KiB
C#

namespace AcDream.App.Physics;
internal enum LiveEntityVectorRoute
{
Projectile,
CanonicalBody,
OrdinaryRemote,
}
/// <summary>
/// Pins retail's one-CPhysicsObj vector-update priority. A missile owns its
/// canonical body first; otherwise a retained static body consumes the wire
/// vector; only an ordinary remote reaches MovementManager storage.
/// </summary>
internal static class LiveEntityVectorRouter
{
internal static LiveEntityVectorRoute Route(
Func<bool> tryProjectile,
Func<bool> tryCanonicalBody,
Action applyOrdinaryRemote)
{
ArgumentNullException.ThrowIfNull(tryProjectile);
ArgumentNullException.ThrowIfNull(tryCanonicalBody);
ArgumentNullException.ThrowIfNull(applyOrdinaryRemote);
if (tryProjectile())
return LiveEntityVectorRoute.Projectile;
if (tryCanonicalBody())
return LiveEntityVectorRoute.CanonicalBody;
applyOrdinaryRemote();
return LiveEntityVectorRoute.OrdinaryRemote;
}
}