From 6dd43fb08636e4caa0e9e5c9f04a8471d7bd54bb Mon Sep 17 00:00:00 2001 From: furo Date: Sun, 1 Oct 2023 18:34:07 +0200 Subject: [PATCH] Don't reset `LastTelePos` on death --- src/game/server/ddracechat.cpp | 6 +++--- src/game/server/entities/character.h | 2 -- src/game/server/player.h | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 935ade688..cfbcfae65 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -1540,7 +1540,7 @@ void CGameContext::ConTele(IConsole::IResult *pResult, void *pUserData) return; Pos = pChrTo->m_Pos; } - pChr->LastTelePos = Pos; + pPlayer->LastTelePos = Pos; pSelf->Teleport(pChr, Pos); pChr->UnFreeze(); pChr->Core()->m_Vel = vec2(0, 0); @@ -1565,12 +1565,12 @@ void CGameContext::ConLastTele(IConsole::IResult *pResult, void *pUserData) pSelf->SendChatTarget(pPlayer->GetCID(), "You're not in a team with /practice turned on. Note that you can't earn a rank with practice enabled."); return; } - if(!pChr->LastTelePos.x) + if(!pPlayer->LastTelePos.x) { pSelf->SendChatTarget(pPlayer->GetCID(), "You haven't previously teleported. Use /tp before using this command."); return; } - pSelf->Teleport(pChr, pChr->LastTelePos); + pSelf->Teleport(pChr, pPlayer->LastTelePos); pChr->UnFreeze(); pChr->Core()->m_Vel = vec2(0, 0); } diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index 8870ef636..89dc031c4 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -217,8 +217,6 @@ public: int m_SpawnTick; int m_WeaponChangeTick; - vec2 LastTelePos; - // Setters/Getters because i don't want to modify vanilla vars access modifiers int GetLastWeapon() { return m_LastWeapon; } void SetLastWeapon(int LastWeap) { m_LastWeapon = LastWeap; } diff --git a/src/game/server/player.h b/src/game/server/player.h index 799a04407..651cc5e62 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -220,6 +220,8 @@ public: bool m_VotedForPractice; int m_SwapTargetsClientID; //Client ID of the swap target for the given player bool m_BirthdayAnnounced; + + vec2 LastTelePos; }; #endif