Merge pull request #259 from tonibm19/patch-2

Fixed horse saddle
master
Mattes D 2013-10-18 07:29:23 -07:00
commit 2a9997881c
1 changed files with 37 additions and 29 deletions

View File

@ -76,6 +76,7 @@ void cHorse::Tick(float a_Dt, cChunk & a_Chunk)
if (m_RearTickCount == 20) if (m_RearTickCount == 20)
{ {
m_bIsRearing = false; m_bIsRearing = false;
m_RearTickCount = 0;
} }
else { m_RearTickCount++;} else { m_RearTickCount++;}
} }
@ -88,6 +89,24 @@ void cHorse::Tick(float a_Dt, cChunk & a_Chunk)
void cHorse::OnRightClicked(cPlayer & a_Player) void cHorse::OnRightClicked(cPlayer & a_Player)
{
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 != NULL)
{ {
@ -107,17 +126,6 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
m_TameAttemptTimes++; m_TameAttemptTimes++;
a_Player.AttachTo(this); 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);
} }
} }