Replace inPopulatedChunks with player counter for NPCs

This commit is contained in:
Gent S
2020-11-22 15:24:34 -05:00
parent 71d4f331b5
commit d1baa0d9f9
3 changed files with 19 additions and 1 deletions

View File

@@ -691,9 +691,12 @@ void MobManager::step(CNServer *serv, time_t currTime) {
for (auto& pair : Mobs) {
// skip chunks without players
if (!ChunkManager::inPopulatedChunks(pair.second->viewableChunks))
if (pair.second->playersInView == 0) //(!ChunkManager::inPopulatedChunks(pair.second->viewableChunks))
continue;
if (pair.second->playersInView < 0)
std::cout << "[WARN] Weird playerview value " << pair.second->playersInView << std::endl;
// skip mob movement and combat if disabled
if (!simulateMobs && pair.second->state != MobState::DEAD
&& pair.second->state != MobState::RETREAT)