mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Merge pull request #7969 from bencie/add-deep-solo
Add /solo and /deep as practice commands
This commit is contained in:
commit
76aeb8e781
|
@ -1783,6 +1783,35 @@ void CGameContext::ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData
|
|||
pChr->SetSolo(false);
|
||||
}
|
||||
|
||||
void CGameContext::ConPracticeSolo(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;
|
||||
|
||||
if(g_Config.m_SvTeam == SV_TEAM_FORBIDDEN || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO)
|
||||
{
|
||||
pSelf->SendChatTarget(pPlayer->GetCID(), "Command is not available on solo servers");
|
||||
return;
|
||||
}
|
||||
|
||||
CGameTeams &Teams = pSelf->m_pController->Teams();
|
||||
int Team = pSelf->GetDDRaceTeam(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;
|
||||
}
|
||||
|
||||
pChr->SetSolo(true);
|
||||
}
|
||||
|
||||
void CGameContext::ConPracticeUnDeep(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
@ -1807,6 +1836,29 @@ void CGameContext::ConPracticeUnDeep(IConsole::IResult *pResult, void *pUserData
|
|||
pChr->UnFreeze();
|
||||
}
|
||||
|
||||
void CGameContext::ConPracticeDeep(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 = pSelf->m_pController->Teams();
|
||||
int Team = pSelf->GetDDRaceTeam(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;
|
||||
}
|
||||
|
||||
pChr->SetDeepFrozen(true);
|
||||
}
|
||||
|
||||
void CGameContext::ConProtectedKill(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
|
|
@ -3652,7 +3652,9 @@ void CGameContext::RegisterChatCommands()
|
|||
Console()->Register("tc", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
Console()->Register("telecursor", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
Console()->Register("unsolo", "", CFGFLAG_CHAT, ConPracticeUnSolo, this, "Puts you out of solo part");
|
||||
Console()->Register("solo", "", CFGFLAG_CHAT, ConPracticeSolo, this, "Puts you into solo part");
|
||||
Console()->Register("undeep", "", CFGFLAG_CHAT, ConPracticeUnDeep, this, "Puts you out of deep freeze");
|
||||
Console()->Register("deep", "", CFGFLAG_CHAT, ConPracticeDeep, this, "Puts you into deep freeze");
|
||||
|
||||
Console()->Register("kill", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConProtectedKill, this, "Kill yourself when kill-protected during a long game (use f1, kill for regular kill)");
|
||||
}
|
||||
|
|
|
@ -463,7 +463,9 @@ private:
|
|||
static void ConTeleCursor(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConLastTele(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConPracticeSolo(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConPracticeUnDeep(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConPracticeDeep(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConProtectedKill(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
static void ConVoteMute(IConsole::IResult *pResult, void *pUserData);
|
||||
|
|
Loading…
Reference in a new issue