1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

Fix roaming

This commit is contained in:
Mordred 2019-04-19 14:04:38 +02:00
parent 018046d03b
commit 19a0ea2e93
3 changed files with 14 additions and 1 deletions

View file

@ -278,10 +278,14 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
//pNaviProvider->setMoveTarget( *this, pos );
auto pos1 = pNaviProvider->getMovePos( *this );
if( Util::distance( pos1, pos ) < 0.1f )
if( Util::distance( pos1, pos ) < 1.1f )
{
// Reached destination
face( pos1 );
setPos( pos1 );
sendPositionUpdate();
pNaviProvider->resetMoveTarget( *this );
pNaviProvider->updateAgentPosition( *this );
return true;
}
//Logger::debug( "{} {} {}", pos1.x, pos1.y, pos1.z );

View file

@ -649,3 +649,10 @@ void Sapphire::World::Navi::NaviProvider::resetMoveTarget( Entity::Chara& chara
{
m_pCrowd->resetMoveTarget( chara.getAgentId() );
}
void Sapphire::World::Navi::NaviProvider::updateAgentPosition( Entity::Chara& chara )
{
removeAgent( chara );
auto newIndex = addAgent( chara );
chara.setAgentId( newIndex );
}

View file

@ -65,6 +65,8 @@ namespace Sapphire::World::Navi
void resetMoveTarget( Entity::Chara& chara );
void updateAgentPosition( Entity::Chara& chara );
protected:
std::string m_internalName;