summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-04 14:14:38 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-04 14:14:38 +0200
commit86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791 (patch)
tree1b5c702a9e9da9115e64c317bdad5aba3544d4a1 /src/Mobs
parentImplemented bed homes (diff)
parentMerge pull request #1059 from mc-server/coverity_fixes (diff)
downloadcuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.gz
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.bz2
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.lz
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.xz
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.zst
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Creeper.cpp10
-rw-r--r--src/Mobs/Monster.cpp18
2 files changed, 22 insertions, 6 deletions
diff --git a/src/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp
index 9cf539427..a7b97f604 100644
--- a/src/Mobs/Creeper.cpp
+++ b/src/Mobs/Creeper.cpp
@@ -43,7 +43,7 @@ void cCreeper::Tick(float a_Dt, cChunk & a_Chunk)
if (m_ExplodingTimer == 30)
{
m_World->DoExplosionAt((m_bIsCharged ? 5 : 3), GetPosX(), GetPosY(), GetPosZ(), false, esMonster, this);
- Destroy();
+ Destroy(); // Just in case we aren't killed by the explosion
}
}
}
@@ -54,6 +54,12 @@ void cCreeper::Tick(float a_Dt, cChunk & a_Chunk)
void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
+ if (m_ExplodingTimer == 30)
+ {
+ // Exploded creepers drop naught but charred flesh, which Minecraft doesn't have
+ return;
+ }
+
int LootingLevel = 0;
if (a_Killer != NULL)
{
@@ -65,7 +71,7 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if (((cMonster *)((cProjectileEntity *)a_Killer)->GetCreator())->GetMobType() == mtSkeleton)
{
- // 12 music discs. TickRand starts from 0, so range = 11. Disk IDs start at 2256, so add that. There.
+ // 12 music discs. TickRand starts from 0 to 11. Disk IDs start at 2256, so add that. There.
AddRandomDropItem(a_Drops, 1, 1, (short)m_World->GetTickRandomNumber(11) + 2256);
}
}
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 839d21314..fa3969d5e 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -301,7 +301,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
if (DoesPosYRequireJump((int)floor(m_Destination.y)))
{
m_bOnGround = false;
- AddPosY(1.5); // Jump!!
+ AddSpeedY(5.2); // Jump!!
}
}
@@ -310,9 +310,19 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
{
Distance.y = 0;
Distance.Normalize();
- Distance *= 5;
- SetSpeedX(Distance.x);
- SetSpeedZ(Distance.z);
+
+ if (m_bOnGround)
+ {
+ Distance *= 2.5;
+ }
+ else
+ {
+ // Don't let the mob move too much if he's falling.
+ Distance *= 0.25;
+ }
+
+ AddSpeedX(Distance.x);
+ AddSpeedZ(Distance.z);
if (m_EMState == ESCAPING)
{ //Runs Faster when escaping :D otherwise they just walk away