5 #include "../Blocks/ChunkInterface.h"
6 #include "../Inventory.h"
38 virtual void Tick (std::chrono::milliseconds a_Dt,
cChunk & a_Chunk)
override;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
#define CLASS_PROTODEF(classname)
cPassiveMonster(const AString &a_ConfigName, eMonsterType a_MobType, const AString &a_SoundHurt, const AString &a_SoundDeath, const AString &a_SoundAmbient, float a_Width, float a_Height)
void TickFarmer()
Tick function for farmers.
bool IsPlantable(Vector3i a_CropsPos)
Returns true if seeds can be planted at a given location.
eFarmerAction m_FarmerAction
static eVillagerType GetRandomProfession()
Returns a random Profession.
static constexpr Vector3i FARMER_SCAN_CROPS_DIST
This distance from the Villager makes for a 31x3x31 area.
void HandleFarmerTryHarvestCrops()
Looks if the farmer has reached it's destination, and if it's still crops and the destination is clos...
eFarmerAction GetFarmerAction(void) const
int GetVilType(void) const
bool IsHarvestable(Vector3i a_CropsPos)
Returns true if the block at the given location is a fully grown up crop.
void ScanAreaForWork()
Searches in a 31x3x31 area to harvest crops or spaces to plant crops.
const cItemGrid & GetInventory(void) const
static const int FARMER_RANDOM_TICK_SPEED
bool IsBlockFarmable(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Returns true if the given blocktype are: crops, potatoes or carrots and they have full grown up.
static constexpr double FARMER_SPECIAL_ACTION_CHANCE
With 10% chance, it takes about 20 seconds to find a spot.
bool CanPlantCrops()
Returns whether the farmer has crops in his inventory to plant.
bool IsIdling()
Returns whether the farmer is not working.
void CheckForNearbyCrops()
Checking for harvesting or planting nearby crops.
void HandleFarmerTryPlaceCrops()
Looks if the farmer has reached it's destination, and if it's still non obstructed farmland and the d...
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
When hit by someone, run away.
cItemGrid & GetInventory(void)
Returns the villager hidden inventory (8 slots).
cVillager(eVillagerType VillagerType)
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.