1
0
Fork 0
cuberite-2a/src/Mobs/Villager.h

71 lines
1.6 KiB
C
Raw Permalink Normal View History

#pragma once
#include "PassiveMonster.h"
#include "../Blocks/ChunkInterface.h"
2020-04-13 16:38:06 +00:00
class cVillager:
public cPassiveMonster
{
2020-04-13 16:38:06 +00:00
using Super = cPassiveMonster;
2016-02-05 21:45:45 +00:00
public:
enum eVillagerType
{
vtFarmer = 0,
vtLibrarian = 1,
vtPriest = 2,
vtBlacksmith = 3,
vtButcher = 4,
vtGeneric = 5,
vtMax
} ;
cVillager(eVillagerType VillagerType);
CLASS_PROTODEF(cVillager)
2018-02-03 11:24:19 +00:00
/** Returns a random Profession. */
static eVillagerType GetRandomProfession();
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;
virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
2018-02-03 11:24:19 +00:00
virtual void KilledBy (TakeDamageInfo & a_TDI) override;
2014-01-27 13:40:31 +00:00
// cVillager functions
2015-07-31 14:49:10 +00:00
/** return true if the given blocktype are: crops, potatoes or carrots. */
bool IsBlockFarmable(BLOCKTYPE a_BlockType);
// 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. */
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. */
void HandleFarmerTryHarvestCrops();
2015-07-31 14:49:10 +00:00
/** 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;
2014-01-27 13:40:31 +00:00
Vector3i m_CropsPos;
} ;