summaryrefslogtreecommitdiffstats
path: root/src/Entities/Boat.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-16 23:14:44 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-16 23:14:44 +0100
commited80ff9fc8c7bd29b696652b3741c16249c26c3b (patch)
treef48222cf7c4d15bd7afb74950d222372f5065e99 /src/Entities/Boat.cpp
parentAPIDump: Ignoring the multi-inheritance members. (diff)
parentBoats spawn on top of a block. not between 4 blocks. (diff)
downloadcuberite-ed80ff9fc8c7bd29b696652b3741c16249c26c3b.tar
cuberite-ed80ff9fc8c7bd29b696652b3741c16249c26c3b.tar.gz
cuberite-ed80ff9fc8c7bd29b696652b3741c16249c26c3b.tar.bz2
cuberite-ed80ff9fc8c7bd29b696652b3741c16249c26c3b.tar.lz
cuberite-ed80ff9fc8c7bd29b696652b3741c16249c26c3b.tar.xz
cuberite-ed80ff9fc8c7bd29b696652b3741c16249c26c3b.tar.zst
cuberite-ed80ff9fc8c7bd29b696652b3741c16249c26c3b.zip
Diffstat (limited to 'src/Entities/Boat.cpp')
-rw-r--r--src/Entities/Boat.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/Entities/Boat.cpp b/src/Entities/Boat.cpp
index 56e766dd4..184aeeeeb 100644
--- a/src/Entities/Boat.cpp
+++ b/src/Entities/Boat.cpp
@@ -39,6 +39,15 @@ void cBoat::DoTakeDamage(TakeDamageInfo & TDI)
if (GetHealth() == 0)
{
+ if (TDI.Attacker != NULL)
+ {
+ if (TDI.Attacker->IsPlayer())
+ {
+ cItems Pickups;
+ Pickups.Add(cItem(E_ITEM_BOAT));
+ m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 0, 0, 0, true);
+ }
+ }
Destroy(true);
}
}
@@ -76,12 +85,32 @@ void cBoat::OnRightClicked(cPlayer & a_Player)
-void cBoat::HandlePhysics(float a_Dt, cChunk & a_Chunk)
+void cBoat::Tick(float a_Dt, cChunk & a_Chunk)
{
- super::HandlePhysics(a_Dt, a_Chunk);
+ super::Tick(a_Dt, a_Chunk);
BroadcastMovementUpdate();
+ SetSpeed(GetSpeed() * 0.97); // Slowly decrease the speed.
+ if (IsBlockWater(m_World->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ())))
+ {
+ SetSpeedY(1);
+ }
}
+
+void cBoat::HandleSpeedFromAttachee(float a_Forward, float a_Sideways)
+{
+ if (GetSpeed().Length() > 7)
+ {
+ return;
+ }
+
+ Vector3d ToAddSpeed(m_Attachee->GetLookVector() * (a_Sideways * 1.5));
+ ToAddSpeed.y = 0;
+
+ AddSpeed(ToAddSpeed);
+}
+
+ \ No newline at end of file