summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-05 06:52:04 +0200
committerkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-05 06:52:04 +0200
commitaccb2971f11bcfa04ef1c225d5084197dc30a6a2 (patch)
tree3b6891945cfd6aa3f4453d4100c92cb2538b6ff5 /source
parentExplosion: Switched from a cube to a sphere. Implemented using cBlockArea and moved block changing code to ChunkMap (diff)
downloadcuberite-accb2971f11bcfa04ef1c225d5084197dc30a6a2.tar
cuberite-accb2971f11bcfa04ef1c225d5084197dc30a6a2.tar.gz
cuberite-accb2971f11bcfa04ef1c225d5084197dc30a6a2.tar.bz2
cuberite-accb2971f11bcfa04ef1c225d5084197dc30a6a2.tar.lz
cuberite-accb2971f11bcfa04ef1c225d5084197dc30a6a2.tar.xz
cuberite-accb2971f11bcfa04ef1c225d5084197dc30a6a2.tar.zst
cuberite-accb2971f11bcfa04ef1c225d5084197dc30a6a2.zip
Diffstat (limited to 'source')
-rw-r--r--source/Entity.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/source/Entity.cpp b/source/Entity.cpp
index c614c8e9c..c2e6b1665 100644
--- a/source/Entity.cpp
+++ b/source/Entity.cpp
@@ -238,23 +238,37 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
}
else
{
- //Push out entity.
- m_bOnGround = true;
- NextPos.y += 0.2;
- LOGD("Entity #%d (%s) is inside a block at {%d,%d,%d}",
- m_UniqueID, GetClass(), BlockX, BlockY, BlockZ);
+ if (BlockIn == E_BLOCK_COBWEB)
+ {
+ NextSpeed.x *= 0.25;
+ NextSpeed.z *= 0.25;
+ }
+ else
+ {
+ //Push out entity.
+ m_bOnGround = true;
+ NextPos.y += 0.2;
+ LOGD("Entity #%d (%s) is inside a block at {%d,%d,%d}",
+ m_UniqueID, GetClass(), BlockX, BlockY, BlockZ);
+ }
}
if (!m_bOnGround)
{
float fallspeed;
- if (!IsBlockWater(BlockIn))
+ if (IsBlockWater(BlockIn))
{
- fallspeed = m_Gravity * a_Dt;
+ fallspeed = -3.0f * a_Dt; //Fall slower in water.
+ }
+ else if (BlockIn == E_BLOCK_COBWEB)
+ {
+ NextSpeed.y *= 0.05; //Reduce overall falling speed
+ fallspeed = 0; //No falling.
}
else
{
- fallspeed = -3.0f * a_Dt; //Fall slower in water.
+ //Normal gravity
+ fallspeed = m_Gravity * a_Dt;
}
NextSpeed.y += fallspeed;
}