1
0

cPawn: Reset last ground height in ResetPosition (#4261)

Prevents fall damage after teleporting/portaling to a lower height.

Fixes #3457
This commit is contained in:
peterbell10 2018-07-23 17:26:48 +01:00 committed by GitHub
parent 01e72ddb65
commit e27290f7d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 2 deletions

View File

@ -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:

View File

@ -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();
}

View File

@ -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. */

View File

@ -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());