mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
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:
commit
78b70ebcf8
|
@ -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++)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue