From 75debadd34e5082f690d208bcd61174961ecee3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Wed, 1 Nov 2023 17:26:29 +0100 Subject: [PATCH] Add `freeze`/`unfreeze` testing commands See #7370. --- src/game/ddracecommands.h | 2 ++ src/game/server/ddracecommands.cpp | 20 ++++++++++++++++++++ src/game/server/gamecontext.h | 2 ++ 3 files changed, 24 insertions(+) diff --git a/src/game/ddracecommands.h b/src/game/ddracecommands.h index bb8ecc8e3f4..e437d5ea857 100644 --- a/src/game/ddracecommands.h +++ b/src/game/ddracecommands.h @@ -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") diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index c55102c2bda..d1af8431d4b 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -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; diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 54d81f249ff..70b7878380e 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -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);