Proper fix for non-master player rotation resetting on load

This commit is contained in:
Kae 2023-06-23 20:27:51 +10:00
parent e64aabfcf1
commit 4328119e1c
3 changed files with 4 additions and 4 deletions

View File

@ -284,16 +284,16 @@ EntityType Player::entityType() const {
void Player::init(World* world, EntityId entityId, EntityMode mode) { void Player::init(World* world, EntityId entityId, EntityMode mode) {
Entity::init(world, entityId, mode); Entity::init(world, entityId, mode);
auto speciesDefinition = Root::singleton().speciesDatabase()->species(m_identity.species);
m_tools->init(this); m_tools->init(this);
m_movementController->init(world); m_movementController->init(world);
m_movementController->setIgnorePhysicsEntities({entityId}); m_movementController->setIgnorePhysicsEntities({entityId});
m_movementController->setRotation(0);
m_statusController->init(this, m_movementController.get()); m_statusController->init(this, m_movementController.get());
m_techController->init(this, m_movementController.get(), m_statusController.get()); m_techController->init(this, m_movementController.get(), m_statusController.get());
if (mode == EntityMode::Master) { if (mode == EntityMode::Master) {
auto speciesDefinition = Root::singleton().speciesDatabase()->species(m_identity.species);
m_movementController->setRotation(0);
m_statusController->setStatusProperty("ouchNoise", speciesDefinition->ouchNoise(m_identity.gender)); m_statusController->setStatusProperty("ouchNoise", speciesDefinition->ouchNoise(m_identity.gender));
m_emoteState = HumanoidEmote::Idle; m_emoteState = HumanoidEmote::Idle;
m_questManager->init(world); m_questManager->init(world);

View File

@ -656,8 +656,8 @@ void WorldClient::handleIncomingPackets(List<PacketPtr> const& packets) {
} }
auto entity = entityFactory->netLoadEntity(entityCreate->entityType, entityCreate->storeData); auto entity = entityFactory->netLoadEntity(entityCreate->entityType, entityCreate->storeData);
entity->init(this, entityCreate->entityId, EntityMode::Slave);
entity->readNetState(entityCreate->firstNetState); entity->readNetState(entityCreate->firstNetState);
entity->init(this, entityCreate->entityId, EntityMode::Slave);
m_entityMap->addEntity(entity); m_entityMap->addEntity(entity);
if (m_interpolationTracker.interpolationEnabled()) { if (m_interpolationTracker.interpolationEnabled()) {

View File

@ -392,8 +392,8 @@ void WorldServer::handleIncomingPackets(ConnectionId clientId, List<PacketPtr> c
} }
auto entity = entityFactory->netLoadEntity(entityCreate->entityType, entityCreate->storeData); auto entity = entityFactory->netLoadEntity(entityCreate->entityType, entityCreate->storeData);
entity->init(this, entityCreate->entityId, EntityMode::Slave);
entity->readNetState(entityCreate->firstNetState); entity->readNetState(entityCreate->firstNetState);
entity->init(this, entityCreate->entityId, EntityMode::Slave);
m_entityMap->addEntity(entity); m_entityMap->addEntity(entity);
if (clientInfo->interpolationTracker.interpolationEnabled()) if (clientInfo->interpolationTracker.interpolationEnabled())