From ed90392636cff0f86f4dff6d84ce346e1ff1ca15 Mon Sep 17 00:00:00 2001 From: murpii Date: Fri, 29 Mar 2024 13:40:45 +0100 Subject: [PATCH] Refresh the jumps after teleporting --- src/game/server/ddracechat.cpp | 3 +++ src/game/server/ddracecommands.cpp | 1 + src/game/server/entities/character.cpp | 6 ++++++ src/game/server/entities/character.h | 1 + 4 files changed, 11 insertions(+) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 4e2b95ce1..d5c566661 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -1605,6 +1605,7 @@ void CGameContext::ConTeleTo(IConsole::IResult *pResult, void *pUserData) // Teleport tee pSelf->Teleport(pCallingCharacter, Pos); + pCallingCharacter->ResetJumps(); pCallingCharacter->UnFreeze(); pCallingCharacter->ResetVelocity(); pCallingPlayer->m_LastTeleTee.Save(pCallingCharacter); @@ -1682,6 +1683,7 @@ void CGameContext::ConTeleXY(IConsole::IResult *pResult, void *pUserData) // Teleport tee pSelf->Teleport(pCallingCharacter, Pos); + pCallingCharacter->ResetJumps(); pCallingCharacter->UnFreeze(); pCallingCharacter->ResetVelocity(); pCallingPlayer->m_LastTeleTee.Save(pCallingCharacter); @@ -1734,6 +1736,7 @@ void CGameContext::ConTeleCursor(IConsole::IResult *pResult, void *pUserData) Pos = pChrTo->m_Pos; } pSelf->Teleport(pChr, Pos); + pChr->ResetJumps(); pChr->UnFreeze(); pChr->ResetVelocity(); pPlayer->m_LastTeleTee.Save(pChr); diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index dd7825d6b..a9ea9693d 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -413,6 +413,7 @@ void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData) Pos += vec2(pChr->Core()->m_Input.m_TargetX, pChr->Core()->m_Input.m_TargetY); } pSelf->Teleport(pChr, Pos); + pChr->ResetJumps(); pChr->UnFreeze(); pChr->SetVelocity(vec2(0, 0)); } diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index a022d4cc0..99747a490 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -2197,6 +2197,12 @@ bool CCharacter::UnFreeze() return false; } +void CCharacter::ResetJumps() +{ + m_Core.m_JumpedTotal = 0; + m_Core.m_Jumped = 0; +} + void CCharacter::GiveWeapon(int Weapon, bool Remove) { if(Weapon == WEAPON_NINJA) diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index 739a74a27..6d85e134a 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -185,6 +185,7 @@ public: bool UnFreeze(); void GiveAllWeapons(); void ResetPickups(); + void ResetJumps(); int m_DDRaceState; int Team(); bool CanCollide(int ClientId);