diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index e14b0f4b..1b211251 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -98,14 +98,14 @@ Sapphire::Entity::BNpc::BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX auto bNpcBaseData = exdData->get< Data::BNpcBase >( m_bNpcBaseId ); assert( bNpcBaseData ); - m_scale = bNpcBaseData->scale; + m_radius = bNpcBaseData->scale; auto modelChara = exdData->get< Data::ModelChara >( bNpcBaseData->modelChara ); if( modelChara ) { auto modelSkeleton = exdData->get< Data::ModelSkeleton >( modelChara->model ); if( modelSkeleton ) - m_scale *= modelSkeleton->scaleFactor; + m_radius *= modelSkeleton->scaleFactor; } // todo: is this actually good? @@ -238,11 +238,11 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos ) return false; } - pNaviProvider->addAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); +// pNaviProvider->addAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); auto pos1 = pNaviProvider->getMovePos( *this ); - if( Util::distance( pos1, pos ) < getScale() ) + if( Util::distance( pos1, pos ) < getRadius() + 3.f ) { // Reached destination face( pos ); @@ -250,7 +250,7 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos ) sendPositionUpdate(); //pNaviProvider->resetMoveTarget( *this ); pNaviProvider->updateAgentPosition( *this ); - pNaviProvider->removeAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); +// pNaviProvider->removeAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); return true; } @@ -274,11 +274,11 @@ bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara ) return false; } - pNaviProvider->addAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); +// pNaviProvider->addAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); auto pos1 = pNaviProvider->getMovePos( *this ); - if( Util::distance( pos1, targetChara.getPos() ) <= ( getScale() + targetChara.getScale() ) + 0.25f ) + if( Util::distance( pos1, targetChara.getPos() ) <= ( getRadius() + targetChara.getRadius() ) + 3.f ) { // Reached destination face( targetChara.getPos() ); @@ -286,7 +286,7 @@ bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara ) sendPositionUpdate(); //pNaviProvider->resetMoveTarget( *this ); pNaviProvider->updateAgentPosition( *this ); - pNaviProvider->removeAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); +// pNaviProvider->removeAgentUpdateFlag( *this, DT_CROWD_OBSTACLE_AVOIDANCE ); return true; } @@ -560,7 +560,7 @@ void Sapphire::Entity::BNpc::update( uint64_t tickCount ) break; } - if( distance > ( getScale() + pHatedActor->getScale() ) ) + if( distance > ( getRadius() + pHatedActor->getRadius() ) ) { if( hasFlag( Immobile ) ) break; @@ -572,10 +572,11 @@ void Sapphire::Entity::BNpc::update( uint64_t tickCount ) moveTo( *pHatedActor ); } - if( ( distance - getScale() ) < 5 ) + if( distance < ( getRadius() + pHatedActor->getRadius() + 3.f ) ) { if( !hasFlag( TurningDisabled ) && face( pHatedActor->getPos() ) ) sendPositionUpdate(); + // in combat range. ATTACK! autoAttack( pHatedActor ); } diff --git a/src/world/Actor/Chara.cpp b/src/world/Actor/Chara.cpp index 6eba77f9..b4e9303d 100644 --- a/src/world/Actor/Chara.cpp +++ b/src/world/Actor/Chara.cpp @@ -39,7 +39,7 @@ Sapphire::Entity::Chara::Chara( ObjKind type, FrameworkPtr pFw ) : m_targetId( INVALID_GAME_OBJECT_ID64 ), m_pFw( std::move( std::move( pFw ) ) ), m_directorId( 0 ), - m_scale( 2.f ) + m_radius( 1.f ) { m_lastTickTime = 0; @@ -715,7 +715,7 @@ void Sapphire::Entity::Chara::setAgentId( uint32_t agentId ) } -float Sapphire::Entity::Chara::getScale() const +float Sapphire::Entity::Chara::getRadius() const { - return m_scale; + return m_radius; } \ No newline at end of file diff --git a/src/world/Actor/Chara.h b/src/world/Actor/Chara.h index 56638255..d882a18a 100644 --- a/src/world/Actor/Chara.h +++ b/src/world/Actor/Chara.h @@ -132,7 +132,7 @@ namespace Sapphire::Entity uint32_t m_agentId; /*! Detour Crowd actor scale */ - float m_scale; + float m_radius; public: Chara( Common::ObjKind type, FrameworkPtr pFw ); @@ -278,7 +278,7 @@ namespace Sapphire::Entity uint32_t getAgentId() const; void setAgentId( uint32_t agentId ); - float getScale() const; + float getRadius() const; }; diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 84b1be39..f6d32053 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -84,7 +84,7 @@ Sapphire::Entity::Player::Player( FrameworkPtr pFw ) : m_queuedZoneing = nullptr; m_status = ActorStatus::Idle; m_invincibilityType = InvincibilityType::InvincibilityNone; - m_scale = 1.f; + m_radius = 1.f; memset( m_questTracking, 0, sizeof( m_questTracking ) ); memset( m_name, 0, sizeof( m_name ) ); diff --git a/src/world/Navi/NaviProvider.cpp b/src/world/Navi/NaviProvider.cpp index 7a0d728a..99cb7079 100644 --- a/src/world/Navi/NaviProvider.cpp +++ b/src/world/Navi/NaviProvider.cpp @@ -572,8 +572,8 @@ int32_t Sapphire::World::Navi::NaviProvider::addAgent( Entity::Chara& chara ) std::memset( ¶ms, 0, sizeof( params ) ); params.height = 3.f; params.maxAcceleration = 25.f; - params.maxSpeed = std::pow( 2, chara.getScale() * 0.35f ) + 1.f; - params.radius = ( chara.getScale() ) * 0.75f; + params.maxSpeed = std::pow( 2, chara.getRadius() * 0.35f ) + 1.f; + params.radius = ( chara.getRadius() ) * 0.75f; params.collisionQueryRange = params.radius * 12.0f; params.pathOptimizationRange = params.radius * 20.0f; params.updateFlags = 0;