moved initialization of entity

This commit is contained in:
EmosewaMC 2022-03-31 18:17:43 -07:00
parent ece83db6ed
commit 0bf2d398ea

View File

@ -1013,15 +1013,15 @@ void HandlePacket(Packet* packet) {
Character* c = user->GetLastUsedChar(); Character* c = user->GetLastUsedChar();
if (c != nullptr) { if (c != nullptr) {
std::u16string username = GeneralUtils::ASCIIToUTF16(c->GetName()); std::u16string username = GeneralUtils::ASCIIToUTF16(c->GetName());
WorldPackets::SendCreateCharacter(packet->systemAddress, c->GetObjectID(), c->GetXMLData(), username, c->GetGMLevel());
WorldPackets::SendServerState(packet->systemAddress);
Game::server->GetReplicaManager()->AddParticipant(packet->systemAddress); Game::server->GetReplicaManager()->AddParticipant(packet->systemAddress);
EntityInfo info {}; EntityInfo info {};
info.lot = 1; info.lot = 1;
Entity* player = EntityManager::Instance()->CreateEntity(info, UserManager::Instance()->GetUser(packet->systemAddress)); Entity* player = EntityManager::Instance()->CreateEntity(info, UserManager::Instance()->GetUser(packet->systemAddress));
WorldPackets::SendCreateCharacter(packet->systemAddress, player, c->GetXMLData(), username, c->GetGMLevel());
WorldPackets::SendServerState(packet->systemAddress);
const auto respawnPoint = player->GetCharacter()->GetRespawnPoint(dZoneManager::Instance()->GetZone()->GetWorldID()); const auto respawnPoint = player->GetCharacter()->GetRespawnPoint(dZoneManager::Instance()->GetZone()->GetWorldID());
EntityManager::Instance()->ConstructEntity(player, UNASSIGNED_SYSTEM_ADDRESS, true); EntityManager::Instance()->ConstructEntity(player, UNASSIGNED_SYSTEM_ADDRESS, true);