diff options
Diffstat (limited to 'src/Mobs/Villager.h')
-rw-r--r-- | src/Mobs/Villager.h | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h index ef1c9e70f..947c1981a 100644 --- a/src/Mobs/Villager.h +++ b/src/Mobs/Villager.h @@ -8,23 +8,21 @@ -class cVillager: - public cPassiveMonster +class cVillager : public cPassiveMonster { using Super = cPassiveMonster; -public: - + public: enum eVillagerType { - vtFarmer = 0, - vtLibrarian = 1, - vtPriest = 2, + vtFarmer = 0, + vtLibrarian = 1, + vtPriest = 2, vtBlacksmith = 3, - vtButcher = 4, - vtGeneric = 5, + vtButcher = 4, + vtGeneric = 5, vtMax - } ; + }; cVillager(eVillagerType VillagerType); @@ -35,8 +33,8 @@ public: // cEntity overrides virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; - virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; - virtual void KilledBy (TakeDamageInfo & a_TDI) override; + virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; + virtual void KilledBy(TakeDamageInfo & a_TDI) override; // cVillager functions /** Returns the villager hidden inventory (8 slots). */ @@ -58,7 +56,7 @@ public: faIdling, faPlanting, faHarvesting, - } ; + }; static const int FARMER_RANDOM_TICK_SPEED = 5; /** With 10% chance, it takes about 20 seconds to find a spot. */ @@ -69,13 +67,16 @@ public: /** Tick function for farmers. */ void TickFarmer(); - /** Searches in a 31x3x31 area to harvest crops or spaces to plant crops. If it found some it will navigate to them. */ + /** Searches in a 31x3x31 area to harvest crops or spaces to plant crops. If it found some it will navigate to them. + */ void ScanAreaForWork(); - /** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 1 block it will harvest them. */ + /** Looks if the farmer has reached it's destination, and if it's still crops and the destination is closer then 1 + * block it will harvest them. */ void HandleFarmerTryHarvestCrops(); - /** Looks if the farmer has reached it's destination, and if it's still non obstructed farmland and the destination is closer then 1 block it will plant crops. */ + /** Looks if the farmer has reached it's destination, and if it's still non obstructed farmland and the destination + * is closer then 1 block it will plant crops. */ void HandleFarmerTryPlaceCrops(); /** Checking for harvesting or planting nearby crops */ @@ -85,25 +86,16 @@ public: bool CanPlantCrops(); /** Returns whether the farmer is not working. */ - bool IsIdling() - { - return m_FarmerAction == faIdling; - } + bool IsIdling() { return m_FarmerAction == faIdling; } // Get and set functions. - int GetVilType(void) const { return m_Type; } + int GetVilType(void) const { return m_Type; } eFarmerAction GetFarmerAction(void) const { return m_FarmerAction; } -private: - + private: int m_ActionCountDown; int m_Type; eFarmerAction m_FarmerAction; Vector3i m_CropsPos; cItemGrid m_Inventory; - -} ; - - - - +}; |