Merge pull request #7282 from furo321/tele-cursor

Teleport the player to their cursor if they aren't in pause
This commit is contained in:
Dennis Felsing 2023-10-02 16:12:00 +00:00 committed by GitHub
commit 78b70ebcf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View file

@ -1518,8 +1518,11 @@ void CGameContext::ConTele(IConsole::IResult *pResult, void *pUserData)
}
vec2 Pos = pPlayer->m_ViewPos;
if(pResult->NumArguments() > 0)
if(pResult->NumArguments() == 0 && !pPlayer->IsPaused())
{
Pos = Pos + vec2(pChr->Core()->m_Input.m_TargetX, pChr->Core()->m_Input.m_TargetY);
}
else if(pResult->NumArguments() > 0)
{
int ClientID;
for(ClientID = 0; ClientID < MAX_CLIENTS; ClientID++)

View file

@ -383,9 +383,15 @@ void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData)
}
CCharacter *pChr = pSelf->GetPlayerChar(Tele);
if(pChr && pSelf->GetPlayerChar(TeleTo))
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
if(pChr && pPlayer && pSelf->GetPlayerChar(TeleTo))
{
pSelf->Teleport(pChr, pSelf->m_apPlayers[TeleTo]->m_ViewPos);
vec2 Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
if(!pPlayer->IsPaused() && !pResult->NumArguments())
Pos = Pos + vec2(pChr->Core()->m_Input.m_TargetX, pChr->Core()->m_Input.m_TargetY);
pSelf->Teleport(pChr, Pos);
pChr->UnFreeze();
pChr->Core()->m_Vel = vec2(0, 0);
}