From 010bc94a342770e96a005353d23d7ebf6cc5aa39 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 10 Sep 2013 22:51:07 +0100 Subject: Entities now maintain speed outside of world --- source/Entities/Entity.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp index 4066e81ab..0aaa2e899 100644 --- a/source/Entities/Entity.cpp +++ b/source/Entities/Entity.cpp @@ -491,8 +491,15 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) if ((BlockY >= cChunkDef::Height) || (BlockY < 0)) { // Outside of the world - // TODO: Current speed should still be added to the entity position - // Otherwise TNT explosions in the void will still effect the bottommost layers of the world + + cChunk * NextChunk = a_Chunk.GetNeighborChunk(BlockX,BlockZ); + // See if we can commit our changes. If not, we will discard them. + if (NextChunk != NULL) + { + SetSpeed(NextSpeed); + NextPos += (NextSpeed * a_Dt); + SetPosition(NextPos); + } return; } -- cgit v1.2.3