mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
Fix roaming
This commit is contained in:
parent
018046d03b
commit
19a0ea2e93
3 changed files with 14 additions and 1 deletions
|
@ -278,10 +278,14 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||||
//pNaviProvider->setMoveTarget( *this, pos );
|
//pNaviProvider->setMoveTarget( *this, pos );
|
||||||
auto pos1 = pNaviProvider->getMovePos( *this );
|
auto pos1 = pNaviProvider->getMovePos( *this );
|
||||||
|
|
||||||
if( Util::distance( pos1, pos ) < 0.1f )
|
if( Util::distance( pos1, pos ) < 1.1f )
|
||||||
{
|
{
|
||||||
// Reached destination
|
// Reached destination
|
||||||
|
face( pos1 );
|
||||||
|
setPos( pos1 );
|
||||||
|
sendPositionUpdate();
|
||||||
pNaviProvider->resetMoveTarget( *this );
|
pNaviProvider->resetMoveTarget( *this );
|
||||||
|
pNaviProvider->updateAgentPosition( *this );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//Logger::debug( "{} {} {}", pos1.x, pos1.y, pos1.z );
|
//Logger::debug( "{} {} {}", pos1.x, pos1.y, pos1.z );
|
||||||
|
|
|
@ -649,3 +649,10 @@ void Sapphire::World::Navi::NaviProvider::resetMoveTarget( Entity::Chara& chara
|
||||||
{
|
{
|
||||||
m_pCrowd->resetMoveTarget( chara.getAgentId() );
|
m_pCrowd->resetMoveTarget( chara.getAgentId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::World::Navi::NaviProvider::updateAgentPosition( Entity::Chara& chara )
|
||||||
|
{
|
||||||
|
removeAgent( chara );
|
||||||
|
auto newIndex = addAgent( chara );
|
||||||
|
chara.setAgentId( newIndex );
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,8 @@ namespace Sapphire::World::Navi
|
||||||
|
|
||||||
void resetMoveTarget( Entity::Chara& chara );
|
void resetMoveTarget( Entity::Chara& chara );
|
||||||
|
|
||||||
|
void updateAgentPosition( Entity::Chara& chara );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_internalName;
|
std::string m_internalName;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue