mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 16:37:45 +00:00
cap poly length for generated nav paths
This commit is contained in:
parent
edf682cc00
commit
c2356b9057
2 changed files with 23 additions and 25 deletions
|
@ -198,34 +198,32 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have to recalculate
|
auto pNaviMgr = m_pFw->get< World::Manager::NaviMgr >();
|
||||||
if( Util::getTimeMs() - m_naviLastUpdate > 500 )
|
auto pNaviProvider = pNaviMgr->getNaviProvider( m_pCurrentZone->getBgPath() );
|
||||||
|
|
||||||
|
if( !pNaviProvider )
|
||||||
{
|
{
|
||||||
auto pNaviMgr = m_pFw->get< World::Manager::NaviMgr >();
|
Logger::error( "No NaviProvider for zone#{0} - {1}",
|
||||||
auto pNaviProvider = pNaviMgr->getNaviProvider( m_pCurrentZone->getBgPath() );
|
m_pCurrentZone->getGuId(),
|
||||||
|
m_pCurrentZone->getInternalName() );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if( !pNaviProvider )
|
auto path = pNaviProvider->findFollowPath( m_pos, pos );
|
||||||
{
|
|
||||||
Logger::error( "No NaviProvider for zone#{0} - {1}",
|
|
||||||
m_pCurrentZone->getGuId(),
|
|
||||||
m_pCurrentZone->getInternalName() );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto path = pNaviProvider->findFollowPath( m_pos, pos );
|
if( !path.empty() )
|
||||||
|
{
|
||||||
|
m_naviLastPath = path;
|
||||||
|
m_naviTarget = pos;
|
||||||
|
m_naviPathStep = 0;
|
||||||
|
m_naviLastUpdate = Util::getTimeMs();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::debug( "No path found from x{0} y{1} z{2} to x{3} y{4} z{5} in {6}",
|
||||||
|
getPos().x, getPos().y, getPos().z, pos.x, pos.y, pos.z, m_pCurrentZone->getInternalName() );
|
||||||
|
|
||||||
if( !path.empty() )
|
hateListClear();
|
||||||
{
|
|
||||||
m_naviLastPath = path;
|
|
||||||
m_naviTarget = pos;
|
|
||||||
m_naviPathStep = 0;
|
|
||||||
m_naviLastUpdate = Util::getTimeMs();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger::debug( "No path found from x{0} y{1} z{2} to x{3} y{4} z{5} in {6}",
|
|
||||||
getPos().x, getPos().y, getPos().z, pos.x, pos.y, pos.z, m_pCurrentZone->getInternalName() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
namespace Sapphire::World::Navi
|
namespace Sapphire::World::Navi
|
||||||
{
|
{
|
||||||
const int32_t MAX_POLYS = 256;
|
const int32_t MAX_POLYS = 8;
|
||||||
const int32_t MAX_SMOOTH = 2048;
|
const int32_t MAX_SMOOTH = 2048;
|
||||||
|
|
||||||
const int32_t NAVMESHSET_MAGIC = 'M' << 24 | 'S' << 16 | 'E' << 8 | 'T'; //'MSET'
|
const int32_t NAVMESHSET_MAGIC = 'M' << 24 | 'S' << 16 | 'E' << 8 | 'T'; //'MSET'
|
||||||
|
|
Loading…
Add table
Reference in a new issue