[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

@@ -361,11 +361,12 @@ static void npcRotateCommand(std::string full, std::vector<std::string>& args, C
}
static void refreshCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {
Player* plr = PlayerManager::getPlayer(sock);
EntityRef ref = {sock};
Entity* plr = ref.getEntity();
ChunkPos currentChunk = plr->chunkPos;
ChunkPos nullChunk = std::make_tuple(0, 0, 0);
Chunking::updatePlayerChunk(sock, currentChunk, nullChunk);
Chunking::updatePlayerChunk(sock, nullChunk, currentChunk);
Chunking::updateEntityChunk(ref, currentChunk, nullChunk);
Chunking::updateEntityChunk(ref, nullChunk, currentChunk);
}
static void instanceCommand(std::string full, std::vector<std::string>& args, CNSocket* sock) {