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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user