From 4ae3b64b077b444c8217f8da265cb5eedeaf699a Mon Sep 17 00:00:00 2001 From: Gargaj Date: Sun, 29 Nov 2015 19:13:31 +0100 Subject: implement breeding --- src/Mobs/Monster.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Mobs/Monster.cpp') diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 060b934ec..d1173c41c 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -104,6 +104,7 @@ cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const A , m_BurnsInDaylight(false) , m_RelativeWalkSpeed(1) , m_Age(1) + , m_AgingTimer(20 * 60 * 20) // about 20 minutes { if (!a_ConfigName.empty()) { @@ -505,6 +506,16 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } // switch (m_EMState) BroadcastMovementUpdate(); + + if (m_AgingTimer > 0) + { + m_AgingTimer--; + if ((m_AgingTimer <= 0) && IsBaby()) + { + SetAge(1); + m_World->BroadcastEntityMetadata(*this); + } + } } -- cgit v1.2.3