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
|
|
@ -192,6 +192,53 @@ public class PlayerMovementControllerTests
|
|||
Assert.Equal(snapped, result.RenderPosition);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BlipPosition_ResnapsPoseWithoutStoppingActiveMotion()
|
||||
{
|
||||
var controller = new PlayerMovementController(MakeFlatEngine());
|
||||
controller.SetPosition(new Vector3(96f, 96f, 50f), 0x0001);
|
||||
controller.Yaw = 0f;
|
||||
controller.Update(PhysicsBody.MinQuantum, new MovementInput(Forward: true));
|
||||
Vector3 velocity = controller.BodyVelocity;
|
||||
Assert.True(velocity.LengthSquared() > 0f);
|
||||
|
||||
var corrected = new Vector3(100f, 98f, 50f);
|
||||
controller.BlipPosition(corrected, 0x0001, corrected);
|
||||
|
||||
Assert.Equal(corrected, controller.Position);
|
||||
Assert.Equal(corrected, controller.RenderPosition);
|
||||
Assert.Equal(velocity, controller.BodyVelocity);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BlipPosition_PublishesCanonicalOutdoorCellAndLocalFrame()
|
||||
{
|
||||
var controller = new PlayerMovementController(MakeFlatEngine());
|
||||
var world = new Vector3(150f, 193f, 50f);
|
||||
var wireLocal = new Vector3(150f, 193f, 50f);
|
||||
|
||||
controller.BlipPosition(world, 0xA9B30038u, wireLocal);
|
||||
|
||||
Assert.Equal(0xA9B40031u, controller.CellId);
|
||||
Assert.Equal(controller.CellId, controller.CellPosition.ObjCellId);
|
||||
Assert.Equal(new Vector3(150f, 1f, 50f), controller.CellPosition.Frame.Origin);
|
||||
Assert.Equal(world, controller.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TeleportPosition_PublishesCanonicalOutdoorCellAndLocalFrame()
|
||||
{
|
||||
var controller = new PlayerMovementController(MakeFlatEngine());
|
||||
var world = new Vector3(12f, 12f, 50f);
|
||||
var wireLocal = new Vector3(12f, 12f, 50f);
|
||||
|
||||
controller.SetPosition(world, 0xA9B40031u, wireLocal);
|
||||
|
||||
Assert.Equal(0xA9B40001u, controller.CellId);
|
||||
Assert.Equal(controller.CellId, controller.CellPosition.ObjCellId);
|
||||
Assert.Equal(wireLocal, controller.CellPosition.Frame.Origin);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Update_HugeQuantumDiscard_ResnapsRenderInterpolationEndpoints()
|
||||
{
|
||||
|
|
@ -293,6 +340,22 @@ public class PlayerMovementControllerTests
|
|||
Assert.True(controller.VerticalVelocity > 0f);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PositionEventGateRequiresContactAndWalkable()
|
||||
{
|
||||
var engine = MakeFlatEngine();
|
||||
var controller = new PlayerMovementController(engine);
|
||||
controller.SetPosition(new Vector3(96f, 96f, 50f), 0x0001);
|
||||
|
||||
Assert.True(controller.CanSendPositionEvent);
|
||||
|
||||
controller.Update(1.0f, new MovementInput(Jump: true));
|
||||
controller.Update(0.016f, new MovementInput(Jump: false));
|
||||
|
||||
Assert.True(controller.IsAirborne);
|
||||
Assert.False(controller.CanSendPositionEvent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JumpChargeSnapshot_TracksHeldChargeAndResetsOnRelease()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue