summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Horse.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2013-10-18 16:29:23 +0200
committerMattes D <github@xoft.cz>2013-10-18 16:29:23 +0200
commit2a9997881cc3283b856c339afff31466555d51e9 (patch)
tree78b027627586d476937a750e770d7028f7c13854 /source/Mobs/Horse.cpp
parentFixed project file after mob update. (diff)
parentMoved lines (diff)
downloadcuberite-2a9997881cc3283b856c339afff31466555d51e9.tar
cuberite-2a9997881cc3283b856c339afff31466555d51e9.tar.gz
cuberite-2a9997881cc3283b856c339afff31466555d51e9.tar.bz2
cuberite-2a9997881cc3283b856c339afff31466555d51e9.tar.lz
cuberite-2a9997881cc3283b856c339afff31466555d51e9.tar.xz
cuberite-2a9997881cc3283b856c339afff31466555d51e9.tar.zst
cuberite-2a9997881cc3283b856c339afff31466555d51e9.zip
Diffstat (limited to 'source/Mobs/Horse.cpp')
-rw-r--r--source/Mobs/Horse.cpp68
1 files changed, 38 insertions, 30 deletions
diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp
index c2a8f6ed0..0077145dc 100644
--- a/source/Mobs/Horse.cpp
+++ b/source/Mobs/Horse.cpp
@@ -76,6 +76,7 @@ void cHorse::Tick(float a_Dt, cChunk & a_Chunk)
if (m_RearTickCount == 20)
{
m_bIsRearing = false;
+ m_RearTickCount = 0;
}
else { m_RearTickCount++;}
}
@@ -89,36 +90,43 @@ 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();
- }
-
- m_TameAttemptTimes++;
- a_Player.AttachTo(this);
-
- 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);
- }
+ 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 if ((a_Player.GetEquippedItem().m_ItemType != E_ITEM_EMPTY) && (!m_bIsSaddled) && (!m_bIsTame))
+ {
+ m_bIsRearing = true;
+ m_RearTickCount = 0;
+ }
+ 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);
+ }
}