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.cpp | |
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.cpp')
-rw-r--r-- | src/Mobs/PassiveMonster.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp index e39f6e23d..b700c0c5d 100644 --- a/src/Mobs/PassiveMonster.cpp +++ b/src/Mobs/PassiveMonster.cpp @@ -77,17 +77,20 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { m_LovePartner = nullptr; } + + // if we have a partner, mate if (m_LovePartner != nullptr) { - // if we have a partner, bump into them until baby is made + if (m_MatingTimer > 0) { + // If we should still mate, keep bumping into them until baby is made Vector3d Pos = m_LovePartner->GetPosition(); MoveToPosition(Pos); } else { - // spawn baby + // Mating finished. Spawn baby Vector3f Pos = (GetPosition() + m_LovePartner->GetPosition()) * 0.5; m_World->SpawnMob(Pos.x, Pos.y, Pos.z, GetMobType(), true); @@ -100,6 +103,7 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } else { + // We have no partner, so we just chase the player if they have our breeding item cItems FollowedItems; GetFollowedItems(FollowedItems); if (FollowedItems.Size() > 0) @@ -117,6 +121,7 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } } + // If we are in love mode but we have no partner, search for a partner neabry if (m_LoveTimer > 0) { if (m_LovePartner == nullptr) @@ -133,7 +138,7 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) virtual bool Item(cEntity * a_Entity) override { - // if we're the same species as someone around and they dont have a partner, swipe right + // if we're the same species as someone around and they don't have a partner, start mating with them if ((a_Entity->GetEntityType() == m_Me->GetEntityType()) && (a_Entity != m_Me)) { cPassiveMonster * Me = static_cast<cPassiveMonster*>(m_Me); @@ -172,7 +177,7 @@ void cPassiveMonster::OnRightClicked(cPlayer & a_Player) { super::OnRightClicked(a_Player); - // if right clicked on the player with breeding items, go into lovemode + // If a player holding breeding items right-clicked me, go into love mode if ((m_LoveCooldown == 0) && !IsInLove() && !IsBaby()) { short HeldItem = a_Player.GetEquippedItem().m_ItemType; |