From 137ed5a55660a9f436da972fa88e66149c5b5e49 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Wed, 16 Oct 2013 19:50:59 +0200 Subject: Improved horse saddling [SEE DESC] Now it checks if horse is already saddled, and if it's, you don't lose the saddle. Also, if the horse isn't tammed, you can't saddle it. --- source/Mobs/Horse.cpp | 64 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'source/Mobs/Horse.cpp') diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index f1972ffc7..6876a5fa4 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -89,38 +89,38 @@ void cHorse::Tick(float a_Dt, cChunk & a_Chunk) void cHorse::OnRightClicked(cPlayer & a_Player) { - if (m_Attachee != NULL) - { - if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) - { - a_Player.Detach(); - return; - } - - if (m_Attachee->IsPlayer()) - { - return; - } - - m_Attachee->Detach(); - } - - if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) - { - if (!a_Player.IsGameModeCreative()) - { - a_Player.GetInventory().RemoveOneEquippedItem(); - } - - // Set saddle state & broadcast metadata - m_bIsSaddled = true; - m_World->BroadcastEntityMetadata(*this); - } - else - { - m_TameAttemptTimes++; - a_Player.AttachTo(this); - } + if (m_Attachee != NULL) + { + if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) + { + a_Player.Detach(); + return; + } + + if (m_Attachee->IsPlayer()) + { + return; + } + + m_Attachee->Detach(); + } + + if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE && !m_bIsSaddled && m_bIsTame) + { + if (!a_Player.IsGameModeCreative()) + { + a_Player.GetInventory().RemoveOneEquippedItem(); + } + + // Set saddle state & broadcast metadata + m_bIsSaddled = true; + m_World->BroadcastEntityMetadata(*this); + } + else + { + m_TameAttemptTimes++; + a_Player.AttachTo(this); + } } -- cgit v1.2.3