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.
29 lines
814 B
C#
29 lines
814 B
C#
namespace AcDream.App.Physics;
|
|
|
|
/// <summary>
|
|
/// Preserves retail ForcePosition's atomic local order: validate the accepted
|
|
/// Position authority, blip once, acknowledge once, then stop if the
|
|
/// acknowledgement synchronously displaced that authority.
|
|
/// </summary>
|
|
internal static class LocalForcePositionTransaction
|
|
{
|
|
internal static bool Apply(
|
|
bool isForcePosition,
|
|
Func<bool> isCurrent,
|
|
Action blip,
|
|
Action acknowledge)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(isCurrent);
|
|
ArgumentNullException.ThrowIfNull(blip);
|
|
ArgumentNullException.ThrowIfNull(acknowledge);
|
|
|
|
if (!isForcePosition)
|
|
return true;
|
|
if (!isCurrent())
|
|
return false;
|
|
|
|
blip();
|
|
acknowledge();
|
|
return isCurrent();
|
|
}
|
|
}
|