acdream/src/AcDream.App/Physics/RemoteTeleportHook.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

55 lines
1.8 KiB
C#

using AcDream.Core.Physics;
namespace AcDream.App.Physics;
/// <summary>
/// Ordered App seam for retail <c>CPhysicsObj::teleport_hook</c>
/// (<c>0x00514ED0</c>). The action bundle keeps the port independently
/// testable while the concrete movement/interpolation/target owners remain
/// in the composition root.
/// </summary>
public static class RemoteTeleportHook
{
private const WeenieError TeleportCancelContext = (WeenieError)0x3Cu;
public static bool Execute(
RemoteTeleportHookActions actions,
Func<bool>? isCurrent = null)
{
ArgumentNullException.ThrowIfNull(actions.CancelMoveTo);
ArgumentNullException.ThrowIfNull(actions.UnStick);
ArgumentNullException.ThrowIfNull(actions.StopInterpolating);
ArgumentNullException.ThrowIfNull(actions.UnConstrain);
ArgumentNullException.ThrowIfNull(actions.NotifyTeleported);
ArgumentNullException.ThrowIfNull(actions.ReportCollisionEnd);
bool Current() => isCurrent?.Invoke() ?? true;
if (!Current())
return false;
actions.CancelMoveTo(TeleportCancelContext);
if (!Current())
return false;
actions.UnStick();
if (!Current())
return false;
actions.StopInterpolating();
if (!Current())
return false;
actions.UnConstrain();
if (!Current())
return false;
actions.NotifyTeleported();
if (!Current())
return false;
actions.ReportCollisionEnd();
return Current();
}
}
public sealed record RemoteTeleportHookActions(
Action<WeenieError> CancelMoveTo,
Action UnStick,
Action StopInterpolating,
Action UnConstrain,
Action NotifyTeleported,
Action ReportCollisionEnd);