diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-01-27 18:27:57 +0100 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-01-27 18:27:57 +0100 |
commit | 06c3bc1ea5e20c3ddc88f66631f675523789f398 (patch) | |
tree | 1f612dc11c3eb341f52c5aa0c03afcad7a6df7cf /src/Mobs | |
parent | Villagers: Fixed only gettings the crops block when farming. (diff) | |
download | cuberite-06c3bc1ea5e20c3ddc88f66631f675523789f398.tar cuberite-06c3bc1ea5e20c3ddc88f66631f675523789f398.tar.gz cuberite-06c3bc1ea5e20c3ddc88f66631f675523789f398.tar.bz2 cuberite-06c3bc1ea5e20c3ddc88f66631f675523789f398.tar.lz cuberite-06c3bc1ea5e20c3ddc88f66631f675523789f398.tar.xz cuberite-06c3bc1ea5e20c3ddc88f66631f675523789f398.tar.zst cuberite-06c3bc1ea5e20c3ddc88f66631f675523789f398.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Villager.cpp | 17 | ||||
-rw-r--r-- | src/Mobs/Villager.h | 1 |
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; |