summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ChunkMap.cpp10
-rw-r--r--src/Entities/Entity.cpp5
-rw-r--r--src/World.cpp6
3 files changed, 10 insertions, 11 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index b93327ddc..14d0d0d94 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -892,7 +892,17 @@ void cChunkMap::AddEntity(OwnedEntity a_Entity)
);
return;
}
+
+ const auto EntityPtr = a_Entity.get();
+ ASSERT(EntityPtr->GetWorld() == m_World);
+
Chunk->AddEntity(std::move(a_Entity));
+
+ EntityPtr->OnAddToWorld(*m_World);
+ ASSERT(!EntityPtr->IsTicking());
+ EntityPtr->SetIsTicking(true);
+
+ cPluginManager::Get()->CallHookSpawnedEntity(*m_World, *EntityPtr);
}
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index b8d17aaa3..f15a01d04 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -82,11 +82,6 @@ cEntity::cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, doubl
cEntity::~cEntity()
{
-
- // Before deleting, the entity needs to have been removed from the world, if ever added
- ASSERT((m_World == nullptr) || !m_World->HasEntity(m_UniqueID));
- ASSERT(!IsTicking());
-
/*
// DEBUG:
FLOGD("Deleting entity {0} at pos {1:.2f} ~ [{2}, {3}]; ptr {4}",
diff --git a/src/World.cpp b/src/World.cpp
index dfc612229..c934c3650 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1023,13 +1023,7 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La
}
for (auto & Entity : EntitiesToAdd)
{
- auto EntityPtr = Entity.get();
- ASSERT(EntityPtr->GetWorld() == this);
m_ChunkMap->AddEntity(std::move(Entity));
- EntityPtr->OnAddToWorld(*this);
- ASSERT(!EntityPtr->IsTicking());
- EntityPtr->SetIsTicking(true);
- cPluginManager::Get()->CallHookSpawnedEntity(*this, *Entity);
}
EntitiesToAdd.clear();