1
0

Fixes for boat entities (#3265)

protocol for vehicles now properly handled, protocol for boat paddles now properly handled, boats can no longer spawn underwater, boats now properly float, boat metadata now properly broadcasted.
This commit is contained in:
beeduck
2016-07-18 13:10:00 -07:00
committed by Mattes D
parent 8ee662c1fa
commit db65e11d57
7 changed files with 189 additions and 10 deletions

View File

@@ -1038,6 +1038,20 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
NextSpeed -= NextSpeed * (m_AirDrag * 20.0f) * DtSec.count();
}
NextSpeed.y += static_cast<float>(fallspeed);
// A real boat floats
if (IsBoat())
{
// Find top water block and sit there
int NextBlockY = BlockY;
BLOCKTYPE NextBlock = NextChunk->GetBlock(RelBlockX, NextBlockY, RelBlockZ);
while (IsBlockWater(NextBlock))
{
NextBlock = NextChunk->GetBlock(RelBlockX, ++NextBlockY, RelBlockZ);
}
NextPos.y = NextBlockY - 0.5;
NextSpeed.y = 0;
}
}
else
{
@@ -1913,6 +1927,14 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
cEntity * cEntity::GetAttached()
{
return m_AttachedTo;
}
void cEntity::AttachTo(cEntity * a_AttachTo)
{