diff options
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r-- | src/Entities/Entity.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index c31f05211..5f6b81497 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -239,7 +239,9 @@ void cEntity::Destroy(bool a_ShouldBroadcast) } cChunk * ParentChunk = GetParentChunk(); - m_World->QueueTask([this, ParentChunk](cWorld & a_World) + // Destroy the entity after two seconds, to give time for all raw pointers such as m_Target + // to de-target this entity. This is a temporary solution. + m_World->ScheduleTask(40, [this, ParentChunk](cWorld & a_World) { LOGD("Destroying entity #%i (%s) from chunk (%d, %d)", this->GetUniqueID(), this->GetClass(), @@ -1591,12 +1593,12 @@ bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d // Stop all mobs from targeting this entity // Stop this entity from targeting other mobs - if (this->IsMob()) + /* if (this->IsMob()) { cMonster * Monster = static_cast<cMonster*>(this); Monster->SetTarget(nullptr); - Monster->StopEveryoneFromTargetingMe(); - } + Monster->StopEveryoneFromTargetingMe(); mobTodo MovingWorld event for all behaviors? + }*/ // Queue add to new world and removal from the old one cWorld * OldWorld = GetWorld(); |