diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 293b675b7..ede927d60 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -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; diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 4794b399a..c29fc190e 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -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)"); } diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 5e705f8e8..147943d14 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -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);