summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Old Mobs/Villager.h
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2014-08-21 16:12:05 +0200
committerSamuel Barney <samjbarney@gmail.com>2014-08-21 16:12:05 +0200
commit77a36b58d8731821c88493742781cee0602d12ef (patch)
tree367ec7d2e9fe037b81721d62a94b01fa092d9227 /src/Mobs/Old Mobs/Villager.h
parentFixed to make metadata work correctly. (diff)
downloadcuberite-77a36b58d8731821c88493742781cee0602d12ef.tar
cuberite-77a36b58d8731821c88493742781cee0602d12ef.tar.gz
cuberite-77a36b58d8731821c88493742781cee0602d12ef.tar.bz2
cuberite-77a36b58d8731821c88493742781cee0602d12ef.tar.lz
cuberite-77a36b58d8731821c88493742781cee0602d12ef.tar.xz
cuberite-77a36b58d8731821c88493742781cee0602d12ef.tar.zst
cuberite-77a36b58d8731821c88493742781cee0602d12ef.zip
Diffstat (limited to 'src/Mobs/Old Mobs/Villager.h')
-rw-r--r--src/Mobs/Old Mobs/Villager.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/Mobs/Old Mobs/Villager.h b/src/Mobs/Old Mobs/Villager.h
new file mode 100644
index 000000000..aa81f0790
--- /dev/null
+++ b/src/Mobs/Old Mobs/Villager.h
@@ -0,0 +1,66 @@
+
+#pragma once
+
+#include "PassiveMonster.h"
+
+
+
+
+
+class cVillager :
+ public cPassiveMonster
+{
+ typedef cPassiveMonster super;
+
+public:
+
+ enum eVillagerType
+ {
+ vtFarmer = 0,
+ vtLibrarian = 1,
+ vtPriest = 2,
+ vtBlacksmith = 3,
+ vtButcher = 4,
+ vtGeneric = 5,
+ vtMax
+ } ;
+
+ cVillager(eVillagerType VillagerType);
+
+ CLASS_PROTODEF(cVillager)
+
+ // cEntity overrides
+ virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
+ 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
+ /** 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;
+
+} ;
+
+
+
+