summaryrefslogtreecommitdiffstats
path: root/source/Entities/Entity.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-09-05 17:44:22 +0200
committermadmaxoft <github@xoft.cz>2013-09-05 17:44:22 +0200
commitcdaa48377846c688b4c003c35e02529ba00c779c (patch)
treedfb4d74621fc06768d4712dba4a297e6cc0e1b78 /source/Entities/Entity.cpp
parentRemoved TimedWait from cEvent. (diff)
parentFixed inconsistent meta naming (diff)
downloadcuberite-cdaa48377846c688b4c003c35e02529ba00c779c.tar
cuberite-cdaa48377846c688b4c003c35e02529ba00c779c.tar.gz
cuberite-cdaa48377846c688b4c003c35e02529ba00c779c.tar.bz2
cuberite-cdaa48377846c688b4c003c35e02529ba00c779c.tar.lz
cuberite-cdaa48377846c688b4c003c35e02529ba00c779c.tar.xz
cuberite-cdaa48377846c688b4c003c35e02529ba00c779c.tar.zst
cuberite-cdaa48377846c688b4c003c35e02529ba00c779c.zip
Diffstat (limited to 'source/Entities/Entity.cpp')
-rw-r--r--source/Entities/Entity.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp
index b936d8d73..56fd36a05 100644
--- a/source/Entities/Entity.cpp
+++ b/source/Entities/Entity.cpp
@@ -503,6 +503,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
@@ -545,18 +546,26 @@ 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)
+ // Friction
+ if (NextSpeed.SqrLength() > 0.0004f)
{
- NextSpeed.x = 0;
- }
- NextSpeed.z *= 0.7f / (1 + a_Dt);
- if (fabs(NextSpeed.z) < 0.05)
- {
- NextSpeed.z = 0;
+ 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;
+ }
}
}
}