summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Chicken.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-29 18:53:06 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-29 18:53:06 +0200
commita53d1051d9033a1be708b76b8a50bca6f5d2bbd9 (patch)
tree698439a8455592d4d9cbf6b23835eea5e0ca8a18 /src/Mobs/Chicken.cpp
parentMerge branch 'master' into mobs2 (diff)
downloadcuberite-a53d1051d9033a1be708b76b8a50bca6f5d2bbd9.tar
cuberite-a53d1051d9033a1be708b76b8a50bca6f5d2bbd9.tar.gz
cuberite-a53d1051d9033a1be708b76b8a50bca6f5d2bbd9.tar.bz2
cuberite-a53d1051d9033a1be708b76b8a50bca6f5d2bbd9.tar.lz
cuberite-a53d1051d9033a1be708b76b8a50bca6f5d2bbd9.tar.xz
cuberite-a53d1051d9033a1be708b76b8a50bca6f5d2bbd9.tar.zst
cuberite-a53d1051d9033a1be708b76b8a50bca6f5d2bbd9.zip
Diffstat (limited to 'src/Mobs/Chicken.cpp')
-rw-r--r--src/Mobs/Chicken.cpp65
1 files changed, 16 insertions, 49 deletions
diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp
index 80cff7fb8..cc691fa5b 100644
--- a/src/Mobs/Chicken.cpp
+++ b/src/Mobs/Chicken.cpp
@@ -6,48 +6,15 @@
cChicken::cChicken(void) :
- super("Chicken", mtChicken, "entity.chicken.hurt", "entity.chicken.death", 0.3, 0.4),
- m_EggDropTimer(0)
+ super("Chicken", mtChicken, "entity.chicken.hurt", "entity.chicken.death", 0.3, 0.4)
{
- SetGravity(-2.0f);
- SetAirDrag(0.0f);
-}
-
-
-
-
-void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
-{
- super::Tick(a_Dt, a_Chunk);
- if (!IsTicking())
- {
- // The base class tick destroyed us
- return;
- }
-
- if (IsBaby())
- {
- return; // Babies don't lay eggs
- }
-
- if ((m_EggDropTimer == 6000) && GetRandomProvider().RandBool())
- {
- cItems Drops;
- m_EggDropTimer = 0;
- Drops.push_back(cItem(E_ITEM_EGG, 1));
- m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
- }
- else if (m_EggDropTimer == 12000)
- {
- cItems Drops;
- m_EggDropTimer = 0;
- Drops.push_back(cItem(E_ITEM_EGG, 1));
- m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
- }
- else
- {
- m_EggDropTimer++;
- }
+ SetGravity(-2.0f);
+ SetAirDrag(0.0f);
+ m_BehaviorBreeder.AttachToMonster(*this);
+ m_BehaviorCoward.AttachToMonster(*this);
+ m_BehaviorItemFollower.AttachToMonster(*this);
+ m_BehaviorWanderer.AttachToMonster(*this);
+ m_BehaviorItemDropper.AttachToMonster(*this);
}
@@ -56,13 +23,13 @@ void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- unsigned int LootingLevel = 0;
- if (a_Killer != nullptr)
- {
- LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
- }
- AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_FEATHER);
- AddRandomDropItem(a_Drops, 1, 1, IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN);
+ unsigned int LootingLevel = 0;
+ if (a_Killer != nullptr)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_FEATHER);
+ AddRandomDropItem(a_Drops, 1, 1, IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN);
}
@@ -71,7 +38,7 @@ void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cChicken::HandleFalling(void)
{
- // empty - chickens don't take fall damage
+ // empty - chickens don't take fall damage
}