[WIP] Convert most of Chunking to Entity-based system

Player and all NPCs now have a common superclass, with virtual functions
so smooth over shared behavior. EntityRef is a simple class that points
to an arbitrary Entity.

This commit is not yet functional.
This commit is contained in:
2021-03-21 02:42:45 +01:00
parent 49f1cb0f00
commit 224ffe05e7
13 changed files with 394 additions and 365 deletions

View File

@@ -133,7 +133,7 @@ static void eggStep(CNServer* serv, time_t currTime) {
egg.second->deadUntil = 0;
egg.second->appearanceData.iHP = 400;
Chunking::addNPCToChunks(Chunking::getViewableChunks(egg.second->chunkPos), egg.first);
Chunking::addEntityToChunks(Chunking::getViewableChunks(egg.second->chunkPos), {egg.first});
}
}
@@ -246,7 +246,7 @@ static void eggPickup(CNSocket* sock, CNPacketData* data) {
if (egg->summoned)
NPCManager::destroyNPC(eggId);
else {
Chunking::removeNPCFromChunks(Chunking::getViewableChunks(egg->chunkPos), eggId);
Chunking::removeEntityFromChunks(Chunking::getViewableChunks(egg->chunkPos), {eggId});
egg->dead = true;
egg->deadUntil = getTime() + (time_t)type->regen * 1000;
egg->appearanceData.iHP = 0;