mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-20 18:55:28 +00:00
fix(character): arriving in a world starts at the target scene or the zone's spawn
A player who had been to a world before arrived at that world's saved respawn point instead of the zone's spawn. The saved point is where a death in that world respawns, not where arriving starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -187,8 +187,9 @@ void ControllablePhysicsComponent::LoadFromSaveData(const tinyxml2::XMLDocument&
|
|||||||
PlaceCharacter();
|
PlaceCharacter();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it came from another zone it starts at its respawn point, the target scene or the zone's spawn (Moon Base always:
|
// If it came from another zone it starts at the target scene or the zone's spawn (Moon Base always: the saved place
|
||||||
// the saved place tends to be on the roof; a target scene too: only possible in a test map)
|
// tends to be on the roof; a target scene too: only possible in a test map). A world's saved respawn point is where a
|
||||||
|
// death there respawns, not where arriving starts.
|
||||||
void ControllablePhysicsComponent::PlaceCharacter() {
|
void ControllablePhysicsComponent::PlaceCharacter() {
|
||||||
auto* const character = m_Parent->GetCharacter();
|
auto* const character = m_Parent->GetCharacter();
|
||||||
if (!character) return;
|
if (!character) return;
|
||||||
@@ -201,10 +202,7 @@ void ControllablePhysicsComponent::PlaceCharacter() {
|
|||||||
NiQuaternion rot = QuatUtils::IDENTITY;
|
NiQuaternion rot = QuatUtils::IDENTITY;
|
||||||
|
|
||||||
auto* targetScene = Game::entityManager->GetSpawnPointEntity(targetSceneName);
|
auto* targetScene = Game::entityManager->GetSpawnPointEntity(targetSceneName);
|
||||||
if (character->HasBeenToWorld(mapID) && targetSceneName.empty()) {
|
if (targetScene != nullptr) {
|
||||||
pos = character->GetRespawnPoint(mapID);
|
|
||||||
rot = Game::zoneManager->GetZone()->GetSpawnRot();
|
|
||||||
} else if (targetScene != nullptr) {
|
|
||||||
pos = targetScene->GetPosition();
|
pos = targetScene->GetPosition();
|
||||||
rot = targetScene->GetRotation();
|
rot = targetScene->GetRotation();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user