Merge pull request #258 from tonibm19/patch-2
Added horse saddling and basic milk code.
This commit is contained in:
commit
9376005778
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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;
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user