From 4ee2632d4f57a5631587809b3d358bc65531b369 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 15 Oct 2013 21:25:33 +0200 Subject: [PATCH 1/5] Fixed saddle horse --- source/Mobs/Horse.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index c2a8f6ed0..0193a88ac 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Horse.h" @@ -105,9 +104,6 @@ void cHorse::OnRightClicked(cPlayer & a_Player) m_Attachee->Detach(); } - m_TameAttemptTimes++; - a_Player.AttachTo(this); - if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) { if (!a_Player.IsGameModeCreative()) @@ -119,6 +115,11 @@ void cHorse::OnRightClicked(cPlayer & a_Player) m_bIsSaddled = true; m_World->BroadcastEntityMetadata(*this); } + else + { + m_TameAttemptTimes++; + a_Player.AttachTo(this); + } } From 2f8a0a8a3a366dc8983e0dccbe1ebd1da269236f Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 15 Oct 2013 21:26:43 +0200 Subject: [PATCH 2/5] Added extra line --- source/Mobs/Horse.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index 0193a88ac..f1972ffc7 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -1,3 +1,4 @@ + #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Horse.h" From 137ed5a55660a9f436da972fa88e66149c5b5e49 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Wed, 16 Oct 2013 19:50:59 +0200 Subject: [PATCH 3/5] 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 | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) 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(); - } + 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); - } + // Set saddle state & broadcast metadata + m_bIsSaddled = true; + m_World->BroadcastEntityMetadata(*this); + } + else + { + m_TameAttemptTimes++; + a_Player.AttachTo(this); + } } From 90c39c55a97d745de4c33e3788afb75f4c3d2bc8 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Thu, 17 Oct 2013 18:41:52 +0200 Subject: [PATCH 4/5] More fixes - You can only tame horses with nothing at hand - Fixed rearing --- source/Mobs/Horse.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index 6876a5fa4..d027e2076 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Horse.h" @@ -76,6 +75,7 @@ void cHorse::Tick(float a_Dt, cChunk & a_Chunk) if (m_RearTickCount == 20) { m_bIsRearing = false; + m_RearTickCount = 0; } else { m_RearTickCount++;} } @@ -105,7 +105,7 @@ void cHorse::OnRightClicked(cPlayer & a_Player) m_Attachee->Detach(); } - if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE && !m_bIsSaddled && m_bIsTame) + if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_SADDLE) && (!m_bIsSaddled) && (m_bIsTame)) { if (!a_Player.IsGameModeCreative()) { @@ -116,7 +116,12 @@ void cHorse::OnRightClicked(cPlayer & a_Player) m_bIsSaddled = true; m_World->BroadcastEntityMetadata(*this); } - else + else if ((a_Player.GetEquippedItem().m_ItemType != E_ITEM_EMPTY) && (!m_bIsSaddled) && (!m_bIsTame)) + { + m_bIsRearing = true; + m_RearTickCount = 0; + } + else { m_TameAttemptTimes++; a_Player.AttachTo(this); From 2c187e53b73eb7104297fd2fa0a25914ff235981 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Thu, 17 Oct 2013 21:28:45 +0200 Subject: [PATCH 5/5] Moved lines don't know if I did well --- source/Mobs/Horse.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index d027e2076..0077145dc 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -1,3 +1,4 @@ + #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Horse.h" @@ -89,22 +90,6 @@ 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) && (!m_bIsSaddled) && (m_bIsTame)) { if (!a_Player.IsGameModeCreative()) @@ -123,6 +108,22 @@ void cHorse::OnRightClicked(cPlayer & a_Player) } else { + if (m_Attachee != NULL) + { + if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID()) + { + a_Player.Detach(); + return; + } + + if (m_Attachee->IsPlayer()) + { + return; + } + + m_Attachee->Detach(); + } + m_TameAttemptTimes++; a_Player.AttachTo(this); }