1
0
Fork 0

Do not spawn mobs too close to player

This commit is contained in:
LogicParrot 2016-01-12 15:04:59 +02:00
parent 062b51c822
commit e77af000df
1 changed files with 63 additions and 54 deletions

View File

@ -3504,6 +3504,15 @@ UInt32 cWorld::SpawnMobFinalize(cMonster * a_Monster)
return cEntity::INVALID_ID;
}
cPlayer * a_Closest_Player = FindClosestPlayer(a_Monster->GetPosition(), 24);
if (a_Closest_Player != nullptr) // Too close to a player, bail out.
{
delete a_Monster;
a_Monster = nullptr;
return cEntity::INVALID_ID;
}
// Initialize the monster into the current world.
if (!a_Monster->Initialize(*this))
{