summaryrefslogtreecommitdiffstats
path: root/src/Entities/Boat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Boat.cpp')
-rw-r--r--src/Entities/Boat.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/Entities/Boat.cpp b/src/Entities/Boat.cpp
index e81e57529..330e54740 100644
--- a/src/Entities/Boat.cpp
+++ b/src/Entities/Boat.cpp
@@ -14,7 +14,10 @@
cBoat::cBoat(double a_X, double a_Y, double a_Z) :
- super(etBoat, a_X, a_Y, a_Z, 0.98, 0.7)
+ super(etBoat, a_X, a_Y, a_Z, 0.98, 0.7),
+ m_LastDamage(0), m_ForwardDirection(0),
+ m_DamageTaken(0.0f), m_Type(0),
+ m_RightPaddleUsed(false), m_LeftPaddleUsed(false)
{
SetMass(20.0f);
SetGravity(-16.0f);
@@ -37,12 +40,15 @@ void cBoat::SpawnOn(cClientHandle & a_ClientHandle)
bool cBoat::DoTakeDamage(TakeDamageInfo & TDI)
{
+ m_LastDamage = 10;
if (!super::DoTakeDamage(TDI))
{
return false;
}
- if (GetHealth() == 0)
+ m_World->BroadcastEntityMetadata(*this);
+
+ if (GetHealth() <= 0)
{
if (TDI.Attacker != nullptr)
{
@@ -112,6 +118,14 @@ void cBoat::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
AddSpeedY(0.2);
}
}
+
+ if (GetLastDamage() > 0)
+ {
+ SetLastDamage(GetLastDamage() - 1);
+ }
+
+ // Broadcast any changes in position
+ m_World->BroadcastEntityMetadata(*this);
}
@@ -130,3 +144,23 @@ void cBoat::HandleSpeedFromAttachee(float a_Forward, float a_Sideways)
AddSpeed(ToAddSpeed);
}
+
+
+
+
+void cBoat::SetLastDamage(int TimeSinceLastHit)
+{
+ m_LastDamage = TimeSinceLastHit;
+}
+
+
+
+
+
+void cBoat::UpdatePaddles(bool a_RightPaddleUsed, bool a_LeftPaddleUsed)
+{
+ m_RightPaddleUsed = a_RightPaddleUsed;
+ m_LeftPaddleUsed = a_LeftPaddleUsed;
+
+ m_World->BroadcastEntityMetadata(*this);
+}