From b18f6637b6c58db20353cd3e77584b646ab36b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Beltr=C3=A1n?= Date: Mon, 21 Aug 2017 10:46:41 +0200 Subject: Fully implemented leashes (#3798) --- src/Mobs/Horse.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/Mobs/Horse.cpp') 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 { -- cgit v1.2.3