mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
Some progress on the crowd front, somehwat working roaming...
This commit is contained in:
parent
4fce8b79b7
commit
018046d03b
3 changed files with 22 additions and 8 deletions
|
@ -224,12 +224,6 @@ void Sapphire::Entity::BNpc::step()
|
|||
|
||||
bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||
{
|
||||
if( Util::distance( getPos(), pos ) <= m_naviTargetReachedDistance )
|
||||
{
|
||||
// Reached destination
|
||||
m_naviLastPath.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
auto pNaviMgr = m_pFw->get< World::Manager::NaviMgr >();
|
||||
auto pNaviProvider = m_pCurrentZone->getNaviProvider();
|
||||
|
@ -281,9 +275,15 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
|||
|
||||
step();*/
|
||||
|
||||
pNaviProvider->setMoveTarget( *this, pos );
|
||||
//pNaviProvider->setMoveTarget( *this, pos );
|
||||
auto pos1 = pNaviProvider->getMovePos( *this );
|
||||
|
||||
if( Util::distance( pos1, pos ) < 0.1f )
|
||||
{
|
||||
// Reached destination
|
||||
pNaviProvider->resetMoveTarget( *this );
|
||||
return true;
|
||||
}
|
||||
//Logger::debug( "{} {} {}", pos1.x, pos1.y, pos1.z );
|
||||
|
||||
m_pCurrentZone->updateActorPosition( *this );
|
||||
|
@ -480,7 +480,7 @@ void Sapphire::Entity::BNpc::update( uint64_t tickCount )
|
|||
|
||||
if( pNaviProvider )
|
||||
{
|
||||
//if( !pNaviProvider->isAgentActive( *this ) )
|
||||
//if( !pNaviProvider->hasTargetState( *this ) )
|
||||
pNaviProvider->setMoveTarget( *this, m_roamPos );
|
||||
}
|
||||
|
||||
|
|
|
@ -638,3 +638,14 @@ bool Sapphire::World::Navi::NaviProvider::isAgentActive( Entity::Chara& chara )
|
|||
return ag && ag->active;
|
||||
|
||||
}
|
||||
|
||||
bool Sapphire::World::Navi::NaviProvider::hasTargetState( Entity::Chara& chara ) const
|
||||
{
|
||||
const dtCrowdAgent* ag = m_pCrowd->getAgent( chara.getAgentId() );
|
||||
return ag->targetState != DT_CROWDAGENT_TARGET_NONE;
|
||||
}
|
||||
|
||||
void Sapphire::World::Navi::NaviProvider::resetMoveTarget( Entity::Chara& chara )
|
||||
{
|
||||
m_pCrowd->resetMoveTarget( chara.getAgentId() );
|
||||
}
|
||||
|
|
|
@ -61,6 +61,9 @@ namespace Sapphire::World::Navi
|
|||
Common::FFXIVARR_POSITION3 getMovePos( Entity::Chara& chara );
|
||||
|
||||
bool isAgentActive( Entity::Chara& chara ) const;
|
||||
bool hasTargetState( Entity::Chara& chara ) const;
|
||||
|
||||
void resetMoveTarget( Entity::Chara& chara );
|
||||
|
||||
protected:
|
||||
std::string m_internalName;
|
||||
|
|
Loading…
Add table
Reference in a new issue