1
0

Entity: Now entites inside a cobweb slow down their speed

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1442 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
keyboard.osh@gmail.com 2013-05-05 04:52:04 +00:00
parent c1e6fb454f
commit accb2971f1

View File

@ -237,6 +237,13 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
} }
} }
else else
{
if (BlockIn == E_BLOCK_COBWEB)
{
NextSpeed.x *= 0.25;
NextSpeed.z *= 0.25;
}
else
{ {
//Push out entity. //Push out entity.
m_bOnGround = true; m_bOnGround = true;
@ -244,17 +251,24 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
LOGD("Entity #%d (%s) is inside a block at {%d,%d,%d}", LOGD("Entity #%d (%s) is inside a block at {%d,%d,%d}",
m_UniqueID, GetClass(), BlockX, BlockY, BlockZ); m_UniqueID, GetClass(), BlockX, BlockY, BlockZ);
} }
}
if (!m_bOnGround) if (!m_bOnGround)
{ {
float fallspeed; 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 else
{ {
fallspeed = -3.0f * a_Dt; //Fall slower in water. //Normal gravity
fallspeed = m_Gravity * a_Dt;
} }
NextSpeed.y += fallspeed; NextSpeed.y += fallspeed;
} }