2013-10-15 11:32:15 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2012-09-23 16:53:08 -04:00
|
|
|
#include "Cow.h"
|
2013-10-16 09:15:51 -04:00
|
|
|
#include "../Entities/Player.h"
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-22 04:39:13 -05:00
|
|
|
cCow::cCow(void) :
|
2020-04-13 12:38:06 -04:00
|
|
|
Super("Cow", mtCow, "entity.cow.hurt", "entity.cow.death", "entity.cow.ambient", 0.9, 1.3)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-01 06:39:56 -04:00
|
|
|
void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2017-10-21 12:55:46 -04:00
|
|
|
if (IsBaby())
|
|
|
|
{
|
|
|
|
return; // Babies don't drop items
|
|
|
|
}
|
|
|
|
|
2015-05-19 14:32:10 -04:00
|
|
|
unsigned int LootingLevel = 0;
|
2014-10-20 16:55:07 -04:00
|
|
|
if (a_Killer != nullptr)
|
2014-02-23 13:44:58 -05:00
|
|
|
{
|
|
|
|
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
|
|
|
|
}
|
|
|
|
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
|
|
|
|
AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2013-10-16 09:15:51 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-15 11:31:26 -04:00
|
|
|
void cCow::OnRightClicked(cPlayer & a_Player)
|
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
Super::OnRightClicked(a_Player);
|
2015-11-29 13:13:31 -05:00
|
|
|
|
|
|
|
short HeldItem = a_Player.GetEquippedItem().m_ItemType;
|
|
|
|
if (HeldItem == E_ITEM_BUCKET)
|
2013-10-15 11:31:26 -04:00
|
|
|
{
|
2020-04-02 08:42:15 -04:00
|
|
|
// Milk the cow.
|
2013-10-15 11:31:26 -04:00
|
|
|
if (!a_Player.IsGameModeCreative())
|
|
|
|
{
|
2020-04-02 08:42:15 -04:00
|
|
|
a_Player.ReplaceOneEquippedItemTossRest(cItem(E_ITEM_MILK));
|
2013-10-15 11:31:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|