diff options
author | Pablo Beltrán <spekdrum@gmail.com> | 2017-08-21 10:46:41 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-08-21 10:46:41 +0200 |
commit | b18f6637b6c58db20353cd3e77584b646ab36b5c (patch) | |
tree | 77b1dcf42aec23ef4aa64a04c906282c5f61ba19 /src/Mobs/Horse.cpp | |
parent | Changed MoveToWorld to ScheduleMoveToWorld in cPlayer::Respawn (#3922) (diff) | |
download | cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.gz cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.bz2 cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.lz cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.xz cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.zst cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.zip |
Diffstat (limited to 'src/Mobs/Horse.cpp')
-rw-r--r-- | src/Mobs/Horse.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index 24287ecc8..13630b0e3 100644 --- a/src/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp @@ -132,24 +132,28 @@ void cHorse::OnRightClicked(cPlayer & a_Player) } else if (a_Player.GetEquippedItem().IsEmpty()) { - if (m_Attachee != nullptr) + // Check if leashed / unleashed to player before try to ride + if (!m_IsLeashActionJustDone) { - if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) + if (m_Attachee != nullptr) { - a_Player.Detach(); - return; - } + if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) + { + a_Player.Detach(); + return; + } - if (m_Attachee->IsPlayer()) - { - return; + if (m_Attachee->IsPlayer()) + { + return; + } + + m_Attachee->Detach(); } - m_Attachee->Detach(); + m_TameAttemptTimes++; + a_Player.AttachTo(this); } - - m_TameAttemptTimes++; - a_Player.AttachTo(this); } else { |