Files
moonwell-client-core/docs
Sam Sung 6b50b9dd6a A worldport's teardown runs at the next frame's start, as one unit (#2773)
A worldport tore the old world down inside its packet: the despawn, the world handle and LOGOUT_CANCEL there, then PLAYER_LEAVING_WORLD before the frame's earlier packets' events had fired.

Reference: `SMSG_NEW_WORLD` (`0x401b00`) posts its teardown `0x401bc0` as a zero-delay timer, and a tick runs its timers before its packets. So the next tick:
- zeroes the world handle (LOGOUT_CANCEL);
- walks the objects (`0x467800`);
- sweeps at the local player's turn (`0x5dd543`).

Changed: the packet only posts the load. Three legs at the next frame's start run the connection's half, the sweep and the objects' teardown. The sweep runs ahead of the objects, so the target is still there in PLAYER_LEAVING_WORLD.

Tests:
- the port frame's events precede the leave, and its listeners still see the old world;
- a port alone leaves in the next frame;
- the leave listener sees the target.

Fixes #2763

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 21:47:03 +07:00
..