Mob-related cleanup.

* NPCs now keep track of their chunk information like PlayerView does
for players
* NPCManager::sendToViewable() parallels PlayerManager::sendToViewable()
* Nano damage and debuffs now count as attacking a mob
* Mobs will de-aggro if something else killed their target
This commit is contained in:
2020-09-25 02:00:26 +02:00
parent 72d625fd8d
commit 279cb78d5f
7 changed files with 66 additions and 99 deletions

View File

@@ -1,11 +1,14 @@
#pragma once
#include "CNStructs.hpp"
#include "ChunkManager.hpp"
class BaseNPC {
public:
sNPCAppearanceData appearanceData;
NPCClass npcClass;
std::pair<int, int> chunkPos;
std::vector<Chunk*> currentChunks;
BaseNPC() {};
BaseNPC(int x, int y, int z, int type, int id) {
@@ -18,6 +21,9 @@ public:
appearanceData.iConditionBitFlag = 0;
appearanceData.iBarkerType = 0;
appearanceData.iNPC_ID = id;
chunkPos = ChunkManager::grabChunk(x, y);
currentChunks = ChunkManager::grabChunks(chunkPos);
};
BaseNPC(int x, int y, int z, int type, int id, NPCClass classType) : BaseNPC(x, y, z, type, id) {
npcClass = classType;