feat(net): port retail physics spawn and event timestamps
Parse the complete PhysicsDesc plus F754/F755 packets, correct every PhysicsState bit, and gate all nine retail update channels with generation-safe immutable snapshots. Preserve ForcePosition, teleport, placement, velocity, parent, pickup, delete, and same-generation CreateObject ordering from the named client. Separate accepted logical lifecycle notifications from retained UI qualities, make GUID replacement and session reset clear every projection exactly once, and add packet, wraparound, malformed-input, parent FIFO, canonical-position, reconnect, and GUID-reuse conformance coverage. Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
parent
d53fe30ffe
commit
8a5d77f7f4
50 changed files with 3809 additions and 649 deletions
|
|
@ -0,0 +1,31 @@
|
|||
using System.Numerics;
|
||||
using AcDream.Core.Physics;
|
||||
|
||||
namespace AcDream.Core.Tests.Physics;
|
||||
|
||||
public sealed class PositionFrameValidationTests
|
||||
{
|
||||
[Fact]
|
||||
public void ValidPositionRequiresInboundCellAndRetailFrameValidity()
|
||||
{
|
||||
Assert.True(PositionFrameValidation.IsValid(
|
||||
0x0101FFFFu, new Vector3(1f, 2f, 3f), Quaternion.Identity));
|
||||
Assert.False(PositionFrameValidation.IsValid(
|
||||
0u, new Vector3(1f, 2f, 3f), Quaternion.Identity));
|
||||
Assert.False(PositionFrameValidation.IsValid(
|
||||
0x0101FFFFu, new Vector3(float.NaN, 2f, 3f), Quaternion.Identity));
|
||||
Assert.False(PositionFrameValidation.IsValid(
|
||||
0x0101FFFFu, new Vector3(1f, 2f, 3f), new Quaternion(0f, 0f, 0f, 0.9f)));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(1.001f, true)]
|
||||
[InlineData(1.0011f, false)]
|
||||
public void QuaternionSquaredNormUsesRetailTolerance(float squaredNorm, bool expected)
|
||||
{
|
||||
var rotation = new Quaternion(0f, 0f, 0f, MathF.Sqrt(squaredNorm));
|
||||
|
||||
Assert.Equal(expected, PositionFrameValidation.IsValid(
|
||||
0x0101FFFFu, Vector3.Zero, rotation));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue