From 5a723454a97fbe00e0a83079493b887be6bd9944 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 20:27:05 +0100 Subject: Now saddle pigs spawn a saddle pickup when killed --- source/Mobs/Pig.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/Mobs/Pig.cpp b/source/Mobs/Pig.cpp index 5427cf35f..0871a38a9 100644 --- a/source/Mobs/Pig.cpp +++ b/source/Mobs/Pig.cpp @@ -22,6 +22,10 @@ cPig::cPig(void) : void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer) { AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP); + if (m_bIsSaddled) + { + a_Drops.push_back(cItem(E_ITEM_SADDLE, 1)); + } } -- cgit v1.2.3 From 1ff051c9a31a5ebf9b8db4a5aad9361bb4299df8 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 20:28:16 +0100 Subject: Now saddled horses spawn a saddle pickup when killed --- source/Mobs/Horse.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp index f9705a451..d18887ea4 100644 --- a/source/Mobs/Horse.cpp +++ b/source/Mobs/Horse.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Horse.h" @@ -142,6 +141,10 @@ void cHorse::OnRightClicked(cPlayer & a_Player) void cHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer) { AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER); + if (m_bIsSaddled) + { + a_Drops.push_back(cItem(E_ITEM_SADDLE, 1)); + } } -- cgit v1.2.3 From 8c9fa9cf35aebc82e213766191914285098923e5 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 20:57:04 +0100 Subject: Added random chicken spawn when throwing an egg --- source/Entities/ProjectileEntity.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp index 4c8e680d0..e33066ab0 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/source/Entities/ProjectileEntity.cpp @@ -247,6 +247,8 @@ void cProjectileEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFac SetPosition(a_HitPos); SetSpeed(0, 0, 0); + + // DEBUG: LOGD("Projectile %d: pos {%.02f, %.02f, %.02f}, hit solid block at face %d", m_UniqueID, @@ -474,8 +476,17 @@ cThrownEggEntity::cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y, void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace) { - // TODO: Random-spawn a chicken or four - + if (m_World->GetTickRandomNumber(7) == 1) + { + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + } + else if (m_World->GetTickRandomNumber(32) == 1) + { + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + } Destroy(); } -- cgit v1.2.3 From 1841d779525de60143b693a1f1eb56c831639ea9 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 20:58:50 +0100 Subject: Fixed indentation --- source/Entities/ProjectileEntity.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp index e33066ab0..07b757d6c 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/source/Entities/ProjectileEntity.cpp @@ -1,4 +1,3 @@ - // ProjectileEntity.cpp // Implements the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types @@ -247,8 +246,6 @@ void cProjectileEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFac SetPosition(a_HitPos); SetSpeed(0, 0, 0); - - // DEBUG: LOGD("Projectile %d: pos {%.02f, %.02f, %.02f}, hit solid block at face %d", m_UniqueID, @@ -483,10 +480,10 @@ void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace else if (m_World->GetTickRandomNumber(32) == 1) { m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); - m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); - } + } Destroy(); } -- cgit v1.2.3 From b182f2532458dc79f0e9f5d6ab5fdf16c3730f97 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 21:00:14 +0100 Subject: Extra line --- source/Entities/ProjectileEntity.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp index 07b757d6c..a0a929d2c 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/source/Entities/ProjectileEntity.cpp @@ -1,3 +1,4 @@ + // ProjectileEntity.cpp // Implements the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types -- cgit v1.2.3 From 669beef2deb98eafd8f23e0c25466e4a73ac3f9b Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 21:37:45 +0100 Subject: attempt at fixing indentation --- source/Entities/ProjectileEntity.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp index a0a929d2c..7b04373d8 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/source/Entities/ProjectileEntity.cpp @@ -1,4 +1,3 @@ - // ProjectileEntity.cpp // Implements the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types @@ -481,10 +480,10 @@ void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace else if (m_World->GetTickRandomNumber(32) == 1) { m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); - m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); - } + } Destroy(); } -- cgit v1.2.3 From b26acdb9db2b904e5871afa0ffd55de223ffb04b Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 21:41:43 +0100 Subject: extra line --- source/Entities/ProjectileEntity.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp index 7b04373d8..6e5b063e9 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/source/Entities/ProjectileEntity.cpp @@ -1,3 +1,4 @@ + // ProjectileEntity.cpp // Implements the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types -- cgit v1.2.3 From 8a6511d329c4158f52ecf685d515efd0e4738d65 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Mon, 28 Oct 2013 21:45:49 +0100 Subject: fixed indentation --- source/Entities/ProjectileEntity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp index 6e5b063e9..017a78806 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/source/Entities/ProjectileEntity.cpp @@ -484,7 +484,7 @@ void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); - } + } Destroy(); } -- cgit v1.2.3 From e96c1aebfebca4efa908862a8fd2119c784b98d0 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Tue, 29 Oct 2013 16:44:45 +0100 Subject: Using tabs --- source/Entities/ProjectileEntity.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp index 017a78806..1d5532718 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/source/Entities/ProjectileEntity.cpp @@ -481,10 +481,10 @@ void cThrownEggEntity::OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace else if (m_World->GetTickRandomNumber(32) == 1) { m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); - m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); - } + m_World->SpawnMob(a_HitPos.x, a_HitPos.y, a_HitPos.z, cMonster::mtChicken); + } Destroy(); } -- cgit v1.2.3