summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2016-02-19 23:08:41 +0100
committerworktycho <work.tycho@gmail.com>2016-02-19 23:08:41 +0100
commit4495dd62b90e8f3a405ae7d9f464a574831aac91 (patch)
tree705c64d5cafc513fecd72bc454018c8d4dd5941e /src/Mobs
parentMerge pull request #3029 from mathias-github/master (diff)
parentStop Wolf from following player when he is flying (diff)
downloadcuberite-4495dd62b90e8f3a405ae7d9f464a574831aac91.tar
cuberite-4495dd62b90e8f3a405ae7d9f464a574831aac91.tar.gz
cuberite-4495dd62b90e8f3a405ae7d9f464a574831aac91.tar.bz2
cuberite-4495dd62b90e8f3a405ae7d9f464a574831aac91.tar.lz
cuberite-4495dd62b90e8f3a405ae7d9f464a574831aac91.tar.xz
cuberite-4495dd62b90e8f3a405ae7d9f464a574831aac91.tar.zst
cuberite-4495dd62b90e8f3a405ae7d9f464a574831aac91.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Wolf.cpp16
1 files 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);
+ }
}
}
}