summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Entities/Entity.h2
-rw-r--r--src/Entities/Pawn.cpp10
-rw-r--r--src/Entities/Pawn.h2
-rw-r--r--src/Entities/Player.cpp1
4 files changed, 13 insertions, 2 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index ae150b4e2..91ad524c7 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -681,7 +681,7 @@ protected:
/** Set the entities position and last sent position.
Only to be used when the caller will broadcast a teleport or equivalent to clients. */
- void ResetPosition(Vector3d a_NewPos);
+ virtual void ResetPosition(Vector3d a_NewPos);
private:
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index 27c04d4b8..fb650e586 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -486,3 +486,13 @@ cEntityEffect * cPawn::GetEntityEffect(cEntityEffect::eType a_EffectType)
auto itr = m_EntityEffects.find(a_EffectType);
return (itr != m_EntityEffects.end()) ? itr->second.get() : nullptr;
}
+
+
+
+
+
+void cPawn::ResetPosition(Vector3d a_NewPosition)
+{
+ super::ResetPosition(a_NewPosition);
+ m_LastGroundHeight = GetPosY();
+}
diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h
index 480b523ea..4de0e14b2 100644
--- a/src/Entities/Pawn.h
+++ b/src/Entities/Pawn.h
@@ -77,6 +77,8 @@ protected:
double m_LastGroundHeight;
bool m_bTouchGround;
+ virtual void ResetPosition(Vector3d a_NewPosition) override;
+
private:
/** A list of all monsters that are targeting this pawn. */
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 181a54870..0f18ebe66 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1650,7 +1650,6 @@ void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ)
{
ResetPosition({a_PosX, a_PosY, a_PosZ});
FreezeInternal(GetPosition(), false);
- m_LastGroundHeight = a_PosY;
m_bIsTeleporting = true;
m_World->BroadcastTeleportEntity(*this, GetClientHandle());