From d966a126248ef653d3cac96ab4ba018dcfb0a938 Mon Sep 17 00:00:00 2001 From: Mat Date: Thu, 9 Apr 2020 23:26:06 +0300 Subject: Don't set entity world twice (#4606) * Don't set entity world twice * Call HookSpawnedEntity when the entity actually spawned --- src/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index fdb66b87d..2df7ef4eb 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1032,6 +1032,7 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La EntityPtr->OnAddToWorld(*this); ASSERT(!EntityPtr->IsTicking()); EntityPtr->SetIsTicking(true); + cPluginManager::Get()->CallHookSpawnedEntity(*this, *Entity); } EntitiesToAdd.clear(); @@ -3088,7 +3089,6 @@ void cWorld::ScheduleTask(int a_DelayTicks, std::function a_Tas void cWorld::AddEntity(OwnedEntity a_Entity) { - a_Entity->SetWorld(this); cCSLock Lock(m_CSEntitiesToAdd); m_EntitiesToAdd.emplace_back(std::move(a_Entity)); } -- cgit v1.2.3