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

fix bnpcs not despawning, stop passive mobs from aggroing the player

This commit is contained in:
NotAdam 2019-01-19 17:50:33 +11:00
parent 362a7d3e17
commit cac23f2fd5
2 changed files with 10 additions and 0 deletions

View file

@ -130,6 +130,11 @@ void Sapphire::Entity::BNpc::spawn( PlayerPtr pTarget )
pTarget->queuePacket( std::make_shared< NpcSpawnPacket >( *getAsBNpc(), *pTarget ) ); pTarget->queuePacket( std::make_shared< NpcSpawnPacket >( *getAsBNpc(), *pTarget ) );
} }
void Sapphire::Entity::BNpc::despawn( PlayerPtr pTarget )
{
pTarget->freePlayerSpawnId( getId() );
}
Sapphire::Entity::BNpcState Sapphire::Entity::BNpc::getState() const Sapphire::Entity::BNpcState Sapphire::Entity::BNpc::getState() const
{ {
return m_state; return m_state;
@ -306,6 +311,10 @@ void Sapphire::Entity::BNpc::update( int64_t currTime )
case BNpcState::Idle: case BNpcState::Idle:
{ {
// passive mobs should ignore players unless aggro'd
if( m_aggressionMode == 1 )
return;
CharaPtr pClosestChara = getClosestChara(); CharaPtr pClosestChara = getClosestChara();
if( pClosestChara && pClosestChara->isAlive() ) if( pClosestChara && pClosestChara->isAlive() )

View file

@ -44,6 +44,7 @@ namespace Sapphire::Entity
virtual ~BNpc() override; virtual ~BNpc() override;
void spawn( PlayerPtr pTarget ) override; void spawn( PlayerPtr pTarget ) override;
void despawn( PlayerPtr pTarget ) override;
uint16_t getModelChara() const; uint16_t getModelChara() const;
uint8_t getLevel() const override; uint8_t getLevel() const override;