2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "PassiveMonster.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cVillager :
|
|
|
|
public cPassiveMonster
|
|
|
|
{
|
|
|
|
typedef cPassiveMonster super;
|
|
|
|
|
|
|
|
public:
|
2013-10-11 15:57:22 -04:00
|
|
|
|
|
|
|
enum eVillagerType
|
|
|
|
{
|
2013-10-13 07:47:55 -04:00
|
|
|
vtFarmer = 0,
|
|
|
|
vtLibrarian = 1,
|
|
|
|
vtPriest = 2,
|
|
|
|
vtBlacksmith = 3,
|
|
|
|
vtButcher = 4,
|
|
|
|
vtGeneric = 5,
|
|
|
|
vtMax
|
2013-10-11 15:57:22 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
cVillager(eVillagerType VillagerType);
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
CLASS_PROTODEF(cVillager);
|
2013-10-08 14:20:49 -04:00
|
|
|
|
2014-03-25 03:10:55 -04:00
|
|
|
// cEntity overrides
|
2014-04-25 18:32:30 -04:00
|
|
|
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
|
2014-01-27 08:40:31 -05:00
|
|
|
virtual void Tick (float a_Dt, cChunk & a_Chunk) override;
|
|
|
|
|
2014-01-27 12:33:57 -05:00
|
|
|
// cVillager functions
|
2014-01-28 10:26:44 -05:00
|
|
|
/** return true if the given blocktype are: crops, potatoes or carrots.*/
|
2014-01-27 09:44:55 -05:00
|
|
|
bool IsBlockFarmable(BLOCKTYPE a_BlockType);
|
2014-01-27 12:33:57 -05:00
|
|
|
|
2014-01-28 10:26:44 -05:00
|
|
|
//////////////////////////////////////////////////////////////////
|
2014-01-27 15:34:22 -05:00
|
|
|
// Farmer functions
|
2014-01-28 10:26:44 -05:00
|
|
|
/** 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();
|
2014-01-27 15:34:22 -05:00
|
|
|
|
2014-01-27 12:33:57 -05:00
|
|
|
// Get and set functions.
|
2014-01-28 10:26:44 -05:00
|
|
|
int GetVilType(void) const { return m_Type; }
|
|
|
|
Vector3i GetCropsPos(void) const { return m_CropsPos; }
|
|
|
|
bool DoesHaveActionActivated(void) const { return m_VillagerAction; }
|
2013-10-08 14:20:49 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-01-27 12:27:57 -05:00
|
|
|
int m_ActionCountDown;
|
2013-10-08 14:20:49 -04:00
|
|
|
int m_Type;
|
2014-01-27 15:34:22 -05:00
|
|
|
bool m_VillagerAction;
|
2014-01-27 08:40:31 -05:00
|
|
|
Vector3i m_CropsPos;
|
2013-10-08 14:20:49 -04:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|