mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-12-20 11:20:03 +00:00
[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user