diff options
author | Hallucino <d@t0t0.fr> | 2015-07-12 18:00:56 +0200 |
---|---|---|
committer | hallucino <d@t0t0.fr> | 2015-07-14 22:41:31 +0200 |
commit | 53207d3f189fc0766928356d1242bc6307cd57b4 (patch) | |
tree | 2b80890a0a96011d1b52538d0160068dd68f168b /src/Mobs | |
parent | Merge pull request #2330 from cuberite/libraryupdate (diff) | |
download | cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.gz cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.bz2 cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.lz cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.xz cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.zst cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Monster.cpp | 1 | ||||
-rw-r--r-- | src/Mobs/Monster.h | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index cb4edb951..4befe307d 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -101,6 +101,7 @@ cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const A , m_TicksSinceLastDamaged(100) , m_BurnsInDaylight(false) , m_RelativeWalkSpeed(1) + , m_Age(1) { if (!a_ConfigName.empty()) { diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index 1076c9544..2832a1570 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -112,10 +112,14 @@ public: void SetRelativeWalkSpeed(double a_WalkSpeed) { m_RelativeWalkSpeed = a_WalkSpeed; } // tolua_export // Overridables to handle ageable mobs - virtual bool IsBaby (void) const { return false; } virtual bool IsTame (void) const { return false; } virtual bool IsSitting (void) const { return false; } + bool IsBaby (void) const { return m_Age < 0; } + char GetAge (void) const { return m_Age; } + void SetAge(char a_Age) { m_Age = a_Age; } + + // tolua_begin /** Returns true if the monster has a custom name. */ @@ -270,6 +274,8 @@ protected: bool m_BurnsInDaylight; double m_RelativeWalkSpeed; + char m_Age; + /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/ void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0); |