summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Mobs/Villager.cpp17
-rw-r--r--src/Mobs/Villager.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp
index 4d358e0a6..f52d60ffa 100644
--- a/src/Mobs/Villager.cpp
+++ b/src/Mobs/Villager.cpp
@@ -13,7 +13,8 @@
cVillager::cVillager(eVillagerType VillagerType) :
super("Villager", mtVillager, "", "", 0.6, 1.8),
m_Type(VillagerType),
- m_DidFindCrops(false)
+ m_DidFindCrops(false),
+ m_ActionCountDown(-1)
{
}
@@ -40,6 +41,19 @@ void cVillager::DoTakeDamage(TakeDamageInfo & a_TDI)
void cVillager::Tick(float a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
+ if (m_ActionCountDown > -1)
+ {
+ m_ActionCountDown--;
+ if (m_ActionCountDown == 0)
+ {
+ switch (m_Type)
+ {
+ case vtFarmer: m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_CROPS, 0);
+ }
+ }
+ return;
+ }
+
if (m_DidFindCrops && !m_bMovingToDestination)
{
if ((GetPosition() - m_CropsPos).Length() < 2)
@@ -50,6 +64,7 @@ void cVillager::Tick(float a_Dt, cChunk & a_Chunk)
cBlockHandler * Handler = cBlockHandler::GetBlockHandler(CropBlock);
Handler->DropBlock(m_World, this, m_CropsPos.x, m_CropsPos.y, m_CropsPos.z);
m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_AIR, 0);
+ m_ActionCountDown = 20;
}
}
m_DidFindCrops = false;
diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h
index 9502f387c..bdbcab39b 100644
--- a/src/Mobs/Villager.h
+++ b/src/Mobs/Villager.h
@@ -38,6 +38,7 @@ public:
private:
+ int m_ActionCountDown;
int m_Type;
bool m_DidFindCrops;
Vector3i m_CropsPos;