fix(load): the respawn checkpoint follows ServerDoneLoadingAllObjects on every load

Live sent PlayerReachedRespawnCheckpoint right after
ServerDoneLoadingAllObjects on 143 of 157 captured loads, with a
rotation: the spawn point the player arrived at, or a checkpoint they
had reached before. DLU sent it before constructing the zone's objects,
only when a checkpoint was saved for the zone, and always unrotated.

It now goes right after ServerDoneLoadingAllObjects on every load: the
saved checkpoint when there is one (DLU saves no rotation for it, so
that one stays unrotated), otherwise the position and facing the
player loaded in at. Inferred: that the loaded-in spot matches live's
spawn point choice (live's is the spawn point object, a few tenths of
a unit from the player's start).

Check: log in fresh to a zone, die before touching any checkpoint and
respawn: you come back where you arrived, facing the same way; reach
a checkpoint, change zones and come back, die: you respawn at that
checkpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 03:29:39 -05:00
parent a25eb34d66
commit 87ce8e3e45
4 changed files with 53 additions and 11 deletions

View File

@@ -1051,17 +1051,11 @@ void LoadPlayer(const SystemAddress& sysAddr) {
serverStates.Send(sysAddr);
const auto respawnPoint = player->GetCharacter()->GetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID());
const auto spawnPosition = player->GetPosition();
const auto spawnRotation = player->GetRotation();
Game::entityManager->ConstructEntity(player, UNASSIGNED_SYSTEM_ADDRESS);
if (respawnPoint != NiPoint3Constant::ZERO) {
GameMessages::PlayerReachedRespawnCheckpoint respawnCheckpoint;
respawnCheckpoint.target = player->GetObjectID();
respawnCheckpoint.pos = respawnPoint;
respawnCheckpoint.rot = QuatUtils::IDENTITY;
respawnCheckpoint.SendToClient(player->GetSystemAddress());
}
// Before the models are constructed: the served meshes' checksums, so a client whose cached checksum is its own
// build's downloads the served mesh again (UgcManifest, docs/UgcServer.md)
if (g_CloneID != 0 && UgcManifest::ServesModels()) {
@@ -1141,9 +1135,7 @@ void LoadPlayer(const SystemAddress& sysAddr) {
invalidTransferList.bCustomerFeedbackOnExit = false;
invalidTransferList.bCustomerFeedbackOnInvalidMapTransfer = false;
invalidTransferList.SendToClient(sysAddr);
GameMessages::ServerDoneLoadingAllObjects doneLoading;
doneLoading.target = player->GetObjectID();
doneLoading.SendToClient(sysAddr);
GameMessages::SendDoneLoading(player->GetObjectID(), respawnPoint, spawnPosition, spawnRotation, sysAddr);
//Send the player it's mail count:
//update: this might not be needed so im going to try disabling this here.