summaryrefslogtreecommitdiffstats
path: root/source/Entities/Entity.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-29 16:25:12 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-29 16:25:12 +0200
commitacaae7a11e81e93fb0b5288ef830052e10a3d8f5 (patch)
tree009b45e24f6eee02e7083591c5fa457dc18da849 /source/Entities/Entity.cpp
parentCorrected comment TypeType (diff)
downloadcuberite-acaae7a11e81e93fb0b5288ef830052e10a3d8f5.tar
cuberite-acaae7a11e81e93fb0b5288ef830052e10a3d8f5.tar.gz
cuberite-acaae7a11e81e93fb0b5288ef830052e10a3d8f5.tar.bz2
cuberite-acaae7a11e81e93fb0b5288ef830052e10a3d8f5.tar.lz
cuberite-acaae7a11e81e93fb0b5288ef830052e10a3d8f5.tar.xz
cuberite-acaae7a11e81e93fb0b5288ef830052e10a3d8f5.tar.zst
cuberite-acaae7a11e81e93fb0b5288ef830052e10a3d8f5.zip
Diffstat (limited to 'source/Entities/Entity.cpp')
-rw-r--r--source/Entities/Entity.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp
index 19a65ef4e..b9810aabb 100644
--- a/source/Entities/Entity.cpp
+++ b/source/Entities/Entity.cpp
@@ -499,6 +499,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
int RelBlockX = BlockX - (NextChunk->GetPosX() * cChunkDef::Width);
int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width);
BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ );
+ BLOCKTYPE BlockBelow = NextChunk->GetBlock( RelBlockX, BlockY - 1, RelBlockZ );
if (!g_BlockIsSolid[BlockIn]) // Making sure we are not inside a solid block
{
if (m_bOnGround) // check if it's still on the ground
@@ -540,13 +541,21 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
}
else
{
- //Friction
- if (NextSpeed.SqrLength() > 0.0004f)
+ if (
+ (BlockBelow != E_BLOCK_RAIL) &&
+ (BlockBelow != E_BLOCK_DETECTOR_RAIL) &&
+ (BlockBelow != E_BLOCK_POWERED_RAIL) &&
+ (BlockBelow != E_BLOCK_ACTIVATOR_RAIL)
+ )
{
- NextSpeed.x *= 0.7f/(1+a_Dt);
- if ( fabs(NextSpeed.x) < 0.05 ) NextSpeed.x = 0;
- NextSpeed.z *= 0.7f/(1+a_Dt);
- if ( fabs(NextSpeed.z) < 0.05 ) NextSpeed.z = 0;
+ //Friction
+ if (NextSpeed.SqrLength() > 0.0004f)
+ {
+ NextSpeed.x *= 0.7f/(1+a_Dt);
+ if ( fabs(NextSpeed.x) < 0.05 ) NextSpeed.x = 0;
+ NextSpeed.z *= 0.7f/(1+a_Dt);
+ if ( fabs(NextSpeed.z) < 0.05 ) NextSpeed.z = 0;
+ }
}
}