mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add /lasttp
This commit is contained in:
parent
cd37c2d5b3
commit
a7ef9c7c6f
|
@ -61,6 +61,7 @@ CHAT_COMMAND("timer", "?s['gametimer'|'broadcast'|'both'|'none'|'cycle']", CFGFL
|
||||||
CHAT_COMMAND("r", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)")
|
CHAT_COMMAND("r", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)")
|
||||||
CHAT_COMMAND("rescue", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)")
|
CHAT_COMMAND("rescue", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)")
|
||||||
CHAT_COMMAND("tp", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTele, this, "Teleport yourself to player or to where you are spectating if no player name is given")
|
CHAT_COMMAND("tp", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTele, this, "Teleport yourself to player or to where you are spectating if no player name is given")
|
||||||
|
CHAT_COMMAND("lasttp", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConLastTele, this, "Teleport yourself to the last location you teleported to.")
|
||||||
CHAT_COMMAND("teleport", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTele, this, "Teleport yourself to player or to where you are spectating if no player name is given")
|
CHAT_COMMAND("teleport", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTele, this, "Teleport yourself to player or to where you are spectating if no player name is given")
|
||||||
CHAT_COMMAND("unsolo", "", CFGFLAG_CHAT, ConPracticeUnSolo, this, "Puts you out of solo part")
|
CHAT_COMMAND("unsolo", "", CFGFLAG_CHAT, ConPracticeUnSolo, this, "Puts you out of solo part")
|
||||||
CHAT_COMMAND("undeep", "", CFGFLAG_CHAT, ConPracticeUnDeep, this, "Puts you out of deep freeze")
|
CHAT_COMMAND("undeep", "", CFGFLAG_CHAT, ConPracticeUnDeep, this, "Puts you out of deep freeze")
|
||||||
|
|
|
@ -1523,12 +1523,41 @@ void CGameContext::ConTele(IConsole::IResult *pResult, void *pUserData)
|
||||||
return;
|
return;
|
||||||
Pos = pChrTo->m_Pos;
|
Pos = pChrTo->m_Pos;
|
||||||
}
|
}
|
||||||
|
pChr->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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameContext::ConLastTele(IConsole::IResult *pResult, void *pUserData)
|
||||||
|
{
|
||||||
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
if(!CheckClientID(pResult->m_ClientID))
|
||||||
|
return;
|
||||||
|
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
|
||||||
|
if(!pPlayer)
|
||||||
|
return;
|
||||||
|
CCharacter *pChr = pPlayer->GetCharacter();
|
||||||
|
if(!pChr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CGameTeams &Teams = ((CGameControllerDDRace *)pSelf->m_pController)->m_Teams;
|
||||||
|
int Team = Teams.m_Core.Team(pResult->m_ClientID);
|
||||||
|
if(!Teams.IsPractice(Team))
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
pSelf->SendChatTarget(pPlayer->GetCID(), "You haven't previously teleported. Use /tp before using this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pSelf->Teleport(pChr, pChr->LastTelePos);
|
||||||
|
pChr->UnFreeze();
|
||||||
|
pChr->Core()->m_Vel = vec2(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void CGameContext::ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData)
|
void CGameContext::ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData)
|
||||||
{
|
{
|
||||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
|
|
@ -217,6 +217,8 @@ 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; }
|
||||||
|
|
|
@ -448,6 +448,7 @@ private:
|
||||||
static void ConSetTimerType(IConsole::IResult *pResult, void *pUserData);
|
static void ConSetTimerType(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConRescue(IConsole::IResult *pResult, void *pUserData);
|
static void ConRescue(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConTele(IConsole::IResult *pResult, void *pUserData);
|
static void ConTele(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
static void ConLastTele(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData);
|
static void ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConPracticeUnDeep(IConsole::IResult *pResult, void *pUserData);
|
static void ConPracticeUnDeep(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConProtectedKill(IConsole::IResult *pResult, void *pUserData);
|
static void ConProtectedKill(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
Loading…
Reference in a new issue