1
0

Mooshroom.cpp: Added right click interaction

This commit is contained in:
TheJumper 2014-02-22 02:11:54 +01:00
parent f45d7d9769
commit 748a9c60b3
2 changed files with 38 additions and 1 deletions

View File

@ -2,11 +2,12 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Mooshroom.h" #include "Mooshroom.h"
#include "../Entities/Player.h"
// TODO: Milk Cow
@ -30,3 +31,38 @@ void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cMooshroom::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);
}
}
if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_BOWL))
{
if (!a_Player.IsGameModeCreative())
{
a_Player.GetInventory().RemoveOneEquippedItem();
a_Player.GetInventory().AddItem(E_ITEM_MUSHROOM_SOUP);
}
}
if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_SHEARS)
{
if (!a_Player.IsGameModeCreative())
{
a_Player.UseEquippedItem();
}
cItems Drops;
Drops.push_back(cItem(E_BLOCK_RED_MUSHROOM, 5, 0));
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
}
}

View File

@ -18,6 +18,7 @@ public:
CLASS_PROTODEF(cMooshroom); CLASS_PROTODEF(cMooshroom);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); } virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); }
} ; } ;