summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-04 08:20:08 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-04 08:20:08 +0100
commit7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1 (patch)
treee83b2297221f3f74360304cbb4671fa8a7079722 /src/Entities/Player.cpp
parentMerge pull request #2941 from LogicParrot/chunkBug2 (diff)
parentcMonster::m_Target safety across worlds (diff)
downloadcuberite-7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1.tar
cuberite-7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1.tar.gz
cuberite-7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1.tar.bz2
cuberite-7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1.tar.lz
cuberite-7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1.tar.xz
cuberite-7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1.tar.zst
cuberite-7767acdc4bdb4bcebcc2ae3fbf84b537d1016cd1.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 7ba6b2bf6..5606e9668 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -176,6 +176,7 @@ cPlayer::~cPlayer(void)
void cPlayer::Destroyed()
{
CloseWindow(false);
+ super::Destroyed();
}
@@ -1681,7 +1682,6 @@ void cPlayer::FreezeInternal(const Vector3d & a_Location, bool a_ManuallyFrozen)
bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d a_NewPosition)
{
ASSERT(a_World != nullptr);
-
if (GetWorld() == a_World)
{
// Don't move to same world
@@ -1708,6 +1708,9 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d
// Remove player from world
GetWorld()->RemovePlayer(this, false);
+ // Stop all mobs from targeting this player
+
+ StopEveryoneFromTargetingMe();
// Send the respawn packet:
if (a_ShouldSendRespawn && (m_ClientHandle != nullptr))
@@ -1720,6 +1723,9 @@ bool cPlayer::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn, Vector3d
SetPosition(a_NewPosition);
+ // Stop all mobs from targeting this player
+ StopEveryoneFromTargetingMe();
+
// Queue adding player to the new world, including all the necessary adjustments to the object
a_World->AddPlayer(this);
cWorld * OldWorld = cRoot::Get()->GetWorld(GetWorld()->GetName()); // Required for the hook HOOK_ENTITY_CHANGED_WORLD