1
0

cMonster::m_Target safety across worlds

This commit is contained in:
LogicParrot
2016-02-01 22:49:34 +02:00
parent a5403c8976
commit 4aade202e0
17 changed files with 294 additions and 83 deletions

View File

@@ -1514,6 +1514,13 @@ bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d
SetPosition(a_NewPosition);
if (this->IsMob())
{
cMonster * Monster = static_cast<cMonster*>(this);
Monster->SetTarget(nullptr);
Monster->StopEveryoneFromTargetingMe();
}
// Queue add to new world
a_World->AddEntity(this);
cWorld * OldWorld = cRoot::Get()->GetWorld(GetWorld()->GetName()); // Required for the hook HOOK_ENTITY_CHANGED_WORLD