1
0

Merge pull request #258 from tonibm19/patch-2

Added horse saddling and basic milk code.
This commit is contained in:
Alexander Harkness 2013-10-15 09:39:16 -07:00
commit 9376005778
3 changed files with 25 additions and 4 deletions

View File

@ -7,10 +7,6 @@
// TODO: Milk Cow
cCow::cCow(void) :
@ -28,6 +24,18 @@ void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}
void cCow::OnRightClicked(cPlayer & a_Player)
{
if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_BUCKET))
{
if (!a_Player.IsGameModeCreative())
{
a_Player.GetInventory().RemoveOneEquippedItem();
a_Player.GetInventory().AddItem(E_ITEM_MILK)
}
}
}

View File

@ -18,6 +18,7 @@ public:
CLASS_PROTODEF(cCow);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
} ;

View File

@ -107,6 +107,18 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
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);
}
}