From f29908ce77246d3431dbc489a95c3c932ccc4f98 Mon Sep 17 00:00:00 2001 From: Tyler Encke Date: Thu, 18 Feb 2016 16:07:17 -0500 Subject: [PATCH] Stop Wolf from following player when he is flying Check to make sure player is not flying before allowing wolf to move to player. Fixed isFlying to IsFlying --- src/Mobs/Wolf.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index d188d91eb..da21468ca 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -344,10 +344,12 @@ void cWolf::TickFollowPlayer() virtual bool Item(cPlayer * a_Player) override { OwnerPos = a_Player->GetPosition(); + OwnerFlying = a_Player->IsFlying(); return true; } public: Vector3d OwnerPos; + bool OwnerFlying; } Callback; if (m_World->DoWithPlayerByUUID(m_OwnerUUID, Callback)) @@ -356,9 +358,12 @@ void cWolf::TickFollowPlayer() double Distance = (Callback.OwnerPos - GetPosition()).Length(); if (Distance > 20) { - Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z); - TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z); - SetTarget(nullptr); + if (!Callback.OwnerFlying) + { + Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z); + TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z); + SetTarget(nullptr); + } } if (Distance < 2) { @@ -371,7 +376,10 @@ void cWolf::TickFollowPlayer() { if (GetTarget() == nullptr) { - MoveToPosition(Callback.OwnerPos); + if (!Callback.OwnerFlying) + { + MoveToPosition(Callback.OwnerPos); + } } } }