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

fix npcs not facing target after being pushed

This commit is contained in:
NotAdam 2019-01-31 23:55:55 +11:00
parent 31cb9ba97c
commit 692c32b934
2 changed files with 4 additions and 3 deletions

View file

@ -222,7 +222,7 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
{ {
// do this first, this will update local actor position and the position of other actors // do this first, this will update local actor position and the position of other actors
// and then this npc will then path from the position after pushing/being pushed // and then this npc will then path from the position after pushing/being pushed
pushNearbyBNpcs(); pushNearbyBNpcs( pos );
if( Util::distance( getPos(), pos ) <= m_naviTargetReachedDistance ) if( Util::distance( getPos(), pos ) <= m_naviTargetReachedDistance )
{ {
@ -629,7 +629,7 @@ void Sapphire::Entity::BNpc::checkAggro()
} }
} }
void Sapphire::Entity::BNpc::pushNearbyBNpcs() void Sapphire::Entity::BNpc::pushNearbyBNpcs( const Common::FFXIVARR_POSITION3& pos )
{ {
for( auto& bNpc : m_inRangeBNpc ) for( auto& bNpc : m_inRangeBNpc )
{ {
@ -651,6 +651,7 @@ void Sapphire::Entity::BNpc::pushNearbyBNpcs()
auto x = ( cosf( angle ) ); auto x = ( cosf( angle ) );
auto z = ( sinf( angle ) ); auto z = ( sinf( angle ) );
bNpc->face( pos );
bNpc->setPos( pos.x + ( x * factor * delta ), bNpc->setPos( pos.x + ( x * factor * delta ),
pos.y, pos.y,
pos.z + ( z * factor * delta ) ); pos.z + ( z * factor * delta ) );

View file

@ -98,7 +98,7 @@ namespace Sapphire::Entity
void checkAggro(); void checkAggro();
void pushNearbyBNpcs(); void pushNearbyBNpcs( const Common::FFXIVARR_POSITION3& pos );
private: private:
uint32_t m_bNpcBaseId; uint32_t m_bNpcBaseId;