2013-07-29 11:13:03 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "PassiveMonster.h"
|
2014-09-26 17:13:19 +00:00
|
|
|
#include "Blocks/ChunkInterface.h"
|
2013-07-29 11:13:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cVillager :
|
|
|
|
public cPassiveMonster
|
|
|
|
{
|
|
|
|
typedef cPassiveMonster super;
|
2016-02-05 21:45:45 +00:00
|
|
|
|
2013-07-29 11:13:03 +00:00
|
|
|
public:
|
2013-10-11 19:57:22 +00:00
|
|
|
|
|
|
|
enum eVillagerType
|
|
|
|
{
|
2013-10-13 11:47:55 +00:00
|
|
|
vtFarmer = 0,
|
|
|
|
vtLibrarian = 1,
|
|
|
|
vtPriest = 2,
|
|
|
|
vtBlacksmith = 3,
|
|
|
|
vtButcher = 4,
|
|
|
|
vtGeneric = 5,
|
|
|
|
vtMax
|
2013-10-11 19:57:22 +00:00
|
|
|
} ;
|
|
|
|
|
|
|
|
cVillager(eVillagerType VillagerType);
|
2013-07-29 11:13:03 +00:00
|
|
|
|
2014-07-22 22:36:13 +00:00
|
|
|
CLASS_PROTODEF(cVillager)
|
2013-10-08 18:20:49 +00:00
|
|
|
|
2014-03-25 07:10:55 +00:00
|
|
|
// cEntity overrides
|
2014-04-25 22:32:30 +00:00
|
|
|
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
|
2015-01-11 21:12:26 +00:00
|
|
|
virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
|
2014-01-27 13:40:31 +00:00
|
|
|
|
2014-01-27 17:33:57 +00:00
|
|
|
// cVillager functions
|
2015-07-31 14:49:10 +00:00
|
|
|
/** return true if the given blocktype are: crops, potatoes or carrots. */
|
2014-01-27 14:44:55 +00:00
|
|
|
bool IsBlockFarmable(BLOCKTYPE a_BlockType);
|
2014-01-27 17:33:57 +00:00
|
|
|
|
2014-01-27 20:34:22 +00:00
|
|
|
// Farmer functions
|
2015-07-31 14:49:10 +00:00
|
|
|
/** Searches in a 11x7x11 area for crops. If it found some it will navigate to them. */
|
2014-01-28 15:26:44 +00:00
|
|
|
void HandleFarmerPrepareFarmCrops();
|
|
|
|
|
2015-07-31 14:49:10 +00:00
|
|
|
/** 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. */
|
2014-01-28 15:26:44 +00:00
|
|
|
void HandleFarmerTryHarvestCrops();
|
|
|
|
|
2015-07-31 14:49:10 +00:00
|
|
|
/** Replaces the crops he harvested. */
|
2014-01-28 15:26:44 +00:00
|
|
|
void HandleFarmerPlaceCrops();
|
2014-01-27 20:34:22 +00:00
|
|
|
|
2014-01-27 17:33:57 +00:00
|
|
|
// Get and set functions.
|
2014-07-17 20:15:34 +00:00
|
|
|
int GetVilType(void) const { return m_Type; }
|
2014-01-28 15:26:44 +00:00
|
|
|
Vector3i GetCropsPos(void) const { return m_CropsPos; }
|
|
|
|
bool DoesHaveActionActivated(void) const { return m_VillagerAction; }
|
2013-10-08 18:20:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-01-27 17:27:57 +00:00
|
|
|
int m_ActionCountDown;
|
2013-10-08 18:20:49 +00:00
|
|
|
int m_Type;
|
2014-01-27 20:34:22 +00:00
|
|
|
bool m_VillagerAction;
|
2014-01-27 13:40:31 +00:00
|
|
|
Vector3i m_CropsPos;
|
2013-10-08 18:20:49 +00:00
|
|
|
|
2013-07-29 11:13:03 +00:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|