FIXED CRUCIAL NINJAGO RESPAWN POINT ISSUE

oops cant believe we had it wrong this WHOLE time
This commit is contained in:
David Markowitz
2025-10-29 00:02:06 -07:00
parent 51610a9f8e
commit 67ca272458
7 changed files with 36 additions and 5 deletions

View File

@@ -203,6 +203,7 @@ int main(int argc, char** argv) {
Database::Destroy("ChatServer");
delete Game::server;
delete Game::logger;
Game::logger = nullptr;
delete Game::config;
return EXIT_SUCCESS;

View File

@@ -323,8 +323,14 @@ void Entity::Initialize() {
pos = m_Character->GetRespawnPoint(mapID);
rot = Game::zoneManager->GetZone()->GetSpawnRot();
} else if (targetScene != nullptr) {
pos = targetScene->GetPosition();
rot = targetScene->GetRotation();
GameMessages::GetRespawnVolumeInfo info{};
if (info.Send(targetScene->GetObjectID()) && info.bIsRespawnVolume) {
pos = info.pos;
rot = info.rot;
} else {
pos = targetScene->GetPosition();
rot = targetScene->GetRotation();
}
} else {
pos = Game::zoneManager->GetZone()->GetSpawnPos();
rot = Game::zoneManager->GetZone()->GetSpawnRot();

View File

@@ -174,9 +174,9 @@ Entity* EntityManager::CreateEntity(EntityInfo info, User* user, Entity* parentE
const auto& respawnVolName = entity->GetVar<std::u16string>(u"respawnVolName");
if (!spawnName.empty()) {
m_SpawnPoints.insert_or_assign(GeneralUtils::UTF16ToWTF8(spawnName), entity->GetObjectID());
m_SpawnPoints.insert({GeneralUtils::UTF16ToWTF8(spawnName), entity->GetObjectID()});
} else if (!respawnVolName.empty()) {
m_SpawnPoints.insert_or_assign(GeneralUtils::UTF16ToWTF8(respawnVolName), entity->GetObjectID());
m_SpawnPoints.insert({GeneralUtils::UTF16ToWTF8(respawnVolName), entity->GetObjectID()});
}
return entity;

View File

@@ -30,6 +30,7 @@
PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent, const int32_t componentID) : PhysicsComponent(parent, componentID) {
RegisterMsg(&PhantomPhysicsComponent::OnGetObjectReportInfo);
RegisterMsg(&PhantomPhysicsComponent::OnGetRespawnVolumeInfo);
m_Position = m_Parent->GetDefaultPosition();
m_Rotation = m_Parent->GetDefaultRotation();
@@ -280,3 +281,10 @@ bool PhantomPhysicsComponent::OnGetObjectReportInfo(GameMessages::GetObjectRepor
return true;
}
bool PhantomPhysicsComponent::OnGetRespawnVolumeInfo(GameMessages::GetRespawnVolumeInfo& respawnInfo) {
respawnInfo.bIsRespawnVolume = m_IsRespawnVolume;
respawnInfo.pos = m_RespawnPos;
respawnInfo.rot = m_RespawnRot;
return true;
}

View File

@@ -12,6 +12,11 @@
#include "eReplicaComponentType.h"
#include "PhysicsComponent.h"
namespace GameMessages {
struct GetObjectReportInfo;
struct GetRespawnVolumeInfo;
};
class LDFBaseData;
class Entity;
class dpEntity;
@@ -117,6 +122,7 @@ public:
private:
bool OnGetObjectReportInfo(GameMessages::GetObjectReportInfo& reportInfo);
bool OnGetRespawnVolumeInfo(GameMessages::GetRespawnVolumeInfo& respawnInfo);
/**
* A scale to apply to the size of the physics object

View File

@@ -943,5 +943,15 @@ namespace GameMessages {
bool bDead{};
};
struct GetRespawnVolumeInfo : public GameMsg {
GetRespawnVolumeInfo() : GameMsg(MessageType::Game::GET_RESPAWN_VOLUME_INFO) {}
bool bIsRespawnVolume{ false };
NiPoint3 pos{};
NiQuaternion rot{ 0.0f, 0.0f, 0.0f, 0.0f };
};
};
#endif // GAMEMESSAGES_H

View File

@@ -184,7 +184,7 @@ static void DLOG(char ch, void *param) {
static size_t len{};
if (ch != '\n') buf[len++] = ch; // we provide the newline in our logger
if (ch == '\n' || len >= sizeof(buf)) {
LOG_DEBUG("%.*s", static_cast<int>(len), buf);
if (Game::logger) LOG_DEBUG("%.*s", static_cast<int>(len), buf);
len = 0;
}
}