Skip to content

Commit

Permalink
Merge pull request ddnet#7404 from Robyt3/Server-Testing-Commands-Fre…
Browse files Browse the repository at this point in the history
…eze-Unfreeze

Add `freeze`/`unfreeze` testing commands
  • Loading branch information
def- authored Nov 1, 2023
2 parents 9b75f85 + 75debad commit 3ec5211
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/game/ddracecommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ CONSOLE_COMMAND("endless_hook", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConEndlessHoo
CONSOLE_COMMAND("unendless_hook", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnEndlessHook, this, "Removes endless hook from you")
CONSOLE_COMMAND("solo", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConSolo, this, "Puts you into solo part")
CONSOLE_COMMAND("unsolo", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnSolo, this, "Puts you out of solo part")
CONSOLE_COMMAND("freeze", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConFreeze, this, "Puts you into freeze")
CONSOLE_COMMAND("unfreeze", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnFreeze, this, "Puts you out of freeze")
CONSOLE_COMMAND("deep", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConDeep, this, "Puts you into deep freeze")
CONSOLE_COMMAND("undeep", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnDeep, this, "Puts you out of deep freeze")
CONSOLE_COMMAND("livefreeze", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConLiveFreeze, this, "Makes you live frozen")
Expand Down
20 changes: 20 additions & 0 deletions src/game/server/ddracecommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,26 @@ void CGameContext::ConUnSolo(IConsole::IResult *pResult, void *pUserData)
pChr->SetSolo(false);
}

void CGameContext::ConFreeze(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!CheckClientID(pResult->m_ClientID))
return;
CCharacter *pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
if(pChr)
pChr->Freeze();
}

void CGameContext::ConUnFreeze(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!CheckClientID(pResult->m_ClientID))
return;
CCharacter *pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
if(pChr)
pChr->UnFreeze();
}

void CGameContext::ConDeep(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
Expand Down
2 changes: 2 additions & 0 deletions src/game/server/gamecontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ class CGameContext : public IGameServer
static void ConUnEndlessHook(IConsole::IResult *pResult, void *pUserData);
static void ConSolo(IConsole::IResult *pResult, void *pUserData);
static void ConUnSolo(IConsole::IResult *pResult, void *pUserData);
static void ConFreeze(IConsole::IResult *pResult, void *pUserData);
static void ConUnFreeze(IConsole::IResult *pResult, void *pUserData);
static void ConDeep(IConsole::IResult *pResult, void *pUserData);
static void ConUnDeep(IConsole::IResult *pResult, void *pUserData);
static void ConLiveFreeze(IConsole::IResult *pResult, void *pUserData);
Expand Down

0 comments on commit 3ec5211

Please sign in to comment.