summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Villager.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-01-28 16:32:01 +0100
committerMattes D <github@xoft.cz>2014-01-28 16:32:01 +0100
commit3390607ee5d31b9385a26a0e4bf563e15c7733a7 (patch)
tree8bd10f47243773945feac41d0b405b55dc34230a /src/Mobs/Villager.h
parentFixed timing on *nix. (diff)
parentRenamed Farmer functions and added doxycomments (diff)
downloadcuberite-3390607ee5d31b9385a26a0e4bf563e15c7733a7.tar
cuberite-3390607ee5d31b9385a26a0e4bf563e15c7733a7.tar.gz
cuberite-3390607ee5d31b9385a26a0e4bf563e15c7733a7.tar.bz2
cuberite-3390607ee5d31b9385a26a0e4bf563e15c7733a7.tar.lz
cuberite-3390607ee5d31b9385a26a0e4bf563e15c7733a7.tar.xz
cuberite-3390607ee5d31b9385a26a0e4bf563e15c7733a7.tar.zst
cuberite-3390607ee5d31b9385a26a0e4bf563e15c7733a7.zip
Diffstat (limited to 'src/Mobs/Villager.h')
-rw-r--r--src/Mobs/Villager.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h
index 4cd9aaa8e..b99ae876f 100644
--- a/src/Mobs/Villager.h
+++ b/src/Mobs/Villager.h
@@ -29,12 +29,36 @@ public:
CLASS_PROTODEF(cVillager);
+ // Override functions
virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
- int GetVilType(void) const { return m_Type; }
+ virtual void Tick (float a_Dt, cChunk & a_Chunk) override;
+
+ // cVillager functions
+ /** return true if the given blocktype are: crops, potatoes or carrots.*/
+ bool IsBlockFarmable(BLOCKTYPE a_BlockType);
+
+ //////////////////////////////////////////////////////////////////
+ // Farmer functions
+ /** It searches in a 11x7x11 area for crops. If it found some it will navigate to them.*/
+ void HandleFarmerPrepareFarmCrops();
+
+ /** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 2 blocks it will harvest them.*/
+ void HandleFarmerTryHarvestCrops();
+
+ /** Replaces the crops he harvested.*/
+ void HandleFarmerPlaceCrops();
+
+ // Get and set functions.
+ int GetVilType(void) const { return m_Type; }
+ Vector3i GetCropsPos(void) const { return m_CropsPos; }
+ bool DoesHaveActionActivated(void) const { return m_VillagerAction; }
private:
+ int m_ActionCountDown;
int m_Type;
+ bool m_VillagerAction;
+ Vector3i m_CropsPos;
} ;