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:
parent
362a7d3e17
commit
cac23f2fd5
2 changed files with 10 additions and 0 deletions
|
@ -130,6 +130,11 @@ void Sapphire::Entity::BNpc::spawn( PlayerPtr 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
|
||||
{
|
||||
return m_state;
|
||||
|
@ -306,6 +311,10 @@ void Sapphire::Entity::BNpc::update( int64_t currTime )
|
|||
|
||||
case BNpcState::Idle:
|
||||
{
|
||||
// passive mobs should ignore players unless aggro'd
|
||||
if( m_aggressionMode == 1 )
|
||||
return;
|
||||
|
||||
CharaPtr pClosestChara = getClosestChara();
|
||||
|
||||
if( pClosestChara && pClosestChara->isAlive() )
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace Sapphire::Entity
|
|||
virtual ~BNpc() override;
|
||||
|
||||
void spawn( PlayerPtr pTarget ) override;
|
||||
void despawn( PlayerPtr pTarget ) override;
|
||||
|
||||
uint16_t getModelChara() const;
|
||||
uint8_t getLevel() const override;
|
||||
|
|
Loading…
Add table
Reference in a new issue