Merge pull request #7280 from furo321/move-lasttelepos

Don't reset `/lasttp` position on death
This commit is contained in:
Dennis Felsing 2023-10-01 22:21:34 +00:00 committed by GitHub
commit 624f4aef21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -1540,7 +1540,7 @@ void CGameContext::ConTele(IConsole::IResult *pResult, void *pUserData)
return; return;
Pos = pChrTo->m_Pos; Pos = pChrTo->m_Pos;
} }
pChr->LastTelePos = Pos; pPlayer->LastTelePos = Pos;
pSelf->Teleport(pChr, Pos); pSelf->Teleport(pChr, Pos);
pChr->UnFreeze(); pChr->UnFreeze();
pChr->Core()->m_Vel = vec2(0, 0); 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."); 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; return;
} }
if(!pChr->LastTelePos.x) if(!pPlayer->LastTelePos.x)
{ {
pSelf->SendChatTarget(pPlayer->GetCID(), "You haven't previously teleported. Use /tp before using this command."); pSelf->SendChatTarget(pPlayer->GetCID(), "You haven't previously teleported. Use /tp before using this command.");
return; return;
} }
pSelf->Teleport(pChr, pChr->LastTelePos); pSelf->Teleport(pChr, pPlayer->LastTelePos);
pChr->UnFreeze(); pChr->UnFreeze();
pChr->Core()->m_Vel = vec2(0, 0); pChr->Core()->m_Vel = vec2(0, 0);
} }

View file

@ -217,8 +217,6 @@ public:
int m_SpawnTick; int m_SpawnTick;
int m_WeaponChangeTick; int m_WeaponChangeTick;
vec2 LastTelePos;
// Setters/Getters because i don't want to modify vanilla vars access modifiers // Setters/Getters because i don't want to modify vanilla vars access modifiers
int GetLastWeapon() { return m_LastWeapon; } int GetLastWeapon() { return m_LastWeapon; }
void SetLastWeapon(int LastWeap) { m_LastWeapon = LastWeap; } void SetLastWeapon(int LastWeap) { m_LastWeapon = LastWeap; }

View file

@ -220,6 +220,8 @@ public:
bool m_VotedForPractice; bool m_VotedForPractice;
int m_SwapTargetsClientID; //Client ID of the swap target for the given player int m_SwapTargetsClientID; //Client ID of the swap target for the given player
bool m_BirthdayAnnounced; bool m_BirthdayAnnounced;
vec2 LastTelePos;
}; };
#endif #endif