diff options
author | Safwat Halaby <SafwatHalaby@users.noreply.github.com> | 2015-11-30 10:07:55 +0100 |
---|---|---|
committer | Safwat Halaby <SafwatHalaby@users.noreply.github.com> | 2015-11-30 11:05:38 +0100 |
commit | dbda48ead40851ce8aab654556f7a1bc475c4e4d (patch) | |
tree | dcde6827dc20832367104b96077a79a8dad308c1 /src/Mobs/PassiveMonster.h | |
parent | Merge pull request #2696 from Gargaj/breeding (diff) | |
download | cuberite-dbda48ead40851ce8aab654556f7a1bc475c4e4d.tar cuberite-dbda48ead40851ce8aab654556f7a1bc475c4e4d.tar.gz cuberite-dbda48ead40851ce8aab654556f7a1bc475c4e4d.tar.bz2 cuberite-dbda48ead40851ce8aab654556f7a1bc475c4e4d.tar.lz cuberite-dbda48ead40851ce8aab654556f7a1bc475c4e4d.tar.xz cuberite-dbda48ead40851ce8aab654556f7a1bc475c4e4d.tar.zst cuberite-dbda48ead40851ce8aab654556f7a1bc475c4e4d.zip |
Diffstat (limited to 'src/Mobs/PassiveMonster.h')
-rw-r--r-- | src/Mobs/PassiveMonster.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Mobs/PassiveMonster.h b/src/Mobs/PassiveMonster.h index ecce4ceb6..0e9250e6c 100644 --- a/src/Mobs/PassiveMonster.h +++ b/src/Mobs/PassiveMonster.h @@ -11,7 +11,7 @@ class cPassiveMonster : public cMonster { typedef cMonster super; - + public: cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); @@ -27,17 +27,32 @@ public: /** Returns the items that make the animal breed - this is usually the same as the ones that make the animal follow, but not necessarily. */ virtual void GetBreedingItems(cItems & a_Items) { GetFollowedItems(a_Items); } + /** Returns the partner which the monster is currently mating with. */ cPassiveMonster * GetPartner(void) const { return m_LovePartner; } + + /** Start the mating process. Causes the monster to keep bumping into the partner until m_MatingTimer reaches zero. */ void EngageLoveMode(cPassiveMonster * a_Partner); + + /** Finish the mating process. Called after a baby is born. Resets all breeding related timers and sets m_LoveCooldown to 20 minutes. */ void ResetLoveMode(); + /** Returns whether the monster has just been fed and is ready to mate. If this is "true" and GetPartner isn't "nullptr", then the monster is mating. */ bool IsInLove() const { return (m_LoveTimer > 0); } + + /** Returns whether the monster is tired of breeding and is in the cooldown state. */ bool IsInLoveCooldown() const { return (m_LoveCooldown > 0); } protected: + /** The monster's breeding partner. */ cPassiveMonster * m_LovePartner; + + /** If above 0, the monster is in love mode, and will breed if a nearby monster is also in love mode. Decrements by 1 per tick till reaching zero. */ int m_LoveTimer; + + /** If above 0, the monster is in cooldown mode and will refuse to breed. Decrements by 1 per tick till reaching zero. */ int m_LoveCooldown; + + /** The monster is engaged in mating, once this reaches zero, a baby will be born. Decrements by 1 per tick till reaching zero, then a baby is made and ResetLoveMode() is called. */ int m_MatingTimer; }; |