From 3f676794f6393f438e42ea6fe7a467627a311dfe Mon Sep 17 00:00:00 2001 From: Pioooooo Date: Sat, 5 Oct 2024 20:13:45 +0800 Subject: [PATCH] Add rcon commands (un)infinite_jump, practice commands /(un)infjump --- src/game/server/ddracechat.cpp | 14 ++++++++++++++ src/game/server/ddracecommands.cpp | 16 ++++++++++++++++ src/game/server/entities/character.cpp | 5 +++++ src/game/server/entities/character.h | 1 + src/game/server/gamecontext.cpp | 4 ++++ src/game/server/gamecontext.h | 4 ++++ 6 files changed, 44 insertions(+) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 1741cbe44..55c867216 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -2166,6 +2166,13 @@ void CGameContext::ConPracticeJetpack(IConsole::IResult *pResult, void *pUserDat ConJetpack(pResult, pUserData); } +void CGameContext::ConPracticeEndlessJump(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + if(pSelf->GetPracticeCharacter(pResult)) + ConEndlessJump(pResult, pUserData); +} + void CGameContext::ConPracticeSetJumps(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; @@ -2208,6 +2215,13 @@ void CGameContext::ConPracticeUnJetpack(IConsole::IResult *pResult, void *pUserD ConUnJetpack(pResult, pUserData); } +void CGameContext::ConPracticeUnEndlessJump(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + if(pSelf->GetPracticeCharacter(pResult)) + ConUnEndlessJump(pResult, pUserData); +} + void CGameContext::ConPracticeUnWeapons(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index e7e9b8251..26f817314 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -277,6 +277,14 @@ void CGameContext::ConJetpack(IConsole::IResult *pResult, void *pUserData) pChr->SetJetpack(true); } +void CGameContext::ConEndlessJump(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + CCharacter *pChr = pSelf->GetPlayerChar(pResult->m_ClientId); + if(pChr) + pChr->SetEndlessJump(true); +} + void CGameContext::ConSetJumps(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; @@ -317,6 +325,14 @@ void CGameContext::ConUnJetpack(IConsole::IResult *pResult, void *pUserData) pChr->SetJetpack(false); } +void CGameContext::ConUnEndlessJump(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + CCharacter *pChr = pSelf->GetPlayerChar(pResult->m_ClientId); + if(pChr) + pChr->SetEndlessJump(false); +} + void CGameContext::ConUnWeapons(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index fe961f1e1..eaeeacb11 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -161,6 +161,11 @@ void CCharacter::SetJetpack(bool Active) m_Core.m_Jetpack = Active; } +void CCharacter::SetEndlessJump(bool Active) +{ + m_Core.m_EndlessJump = Active; +} + void CCharacter::SetJumps(int Jumps) { m_Core.m_Jumps = Jumps; diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index 59793707c..0b2d61dd6 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -48,6 +48,7 @@ public: void SetWeapon(int W); void SetJetpack(bool Active); + void SetEndlessJump(bool Active); void SetJumps(int Jumps); void SetSolo(bool Solo); void SetSuper(bool Super); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 1a2e24d1f..6d9537f0b 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3692,6 +3692,8 @@ void CGameContext::RegisterDDRaceCommands() Console()->Register("super", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConSuper, this, "Makes you super"); Console()->Register("unsuper", "", CFGFLAG_SERVER, ConUnSuper, this, "Removes super from you"); Console()->Register("invincible", "?i['0'|'1']", CFGFLAG_SERVER | CMDFLAG_TEST, ConToggleInvincible, this, "Toggles invincible mode"); + Console()->Register("infinite_jump", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConEndlessJump, this, "Gives you infinite jump"); + Console()->Register("uninfinite_jump", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnEndlessJump, this, "Removes infinite jump from you"); Console()->Register("endless_hook", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConEndlessHook, this, "Gives you endless hook"); Console()->Register("unendless_hook", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnEndlessHook, this, "Removes endless hook from you"); Console()->Register("solo", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConSolo, this, "Puts you into solo part"); @@ -3825,6 +3827,8 @@ void CGameContext::RegisterChatCommands() Console()->Register("unweapons", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnWeapons, this, "Removes all weapons from you"); Console()->Register("ninja", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeNinja, this, "Makes you a ninja"); Console()->Register("unninja", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnNinja, this, "Removes ninja from you"); + Console()->Register("infjump", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeEndlessJump, this, "Gives you infinite jump"); + Console()->Register("uninfjump", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnEndlessJump, this, "Removes infinite jump from you"); Console()->Register("endless", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeEndlessHook, this, "Gives you endless hook"); Console()->Register("unendless", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnEndlessHook, this, "Removes endless hook from you"); Console()->Register("invincible", "?i['0'|'1']", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeToggleInvincible, this, "Toggles invincible mode"); diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 4551fbc1f..85055d7d3 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -396,12 +396,14 @@ private: static void ConGrenade(IConsole::IResult *pResult, void *pUserData); static void ConLaser(IConsole::IResult *pResult, void *pUserData); static void ConJetpack(IConsole::IResult *pResult, void *pUserData); + static void ConEndlessJump(IConsole::IResult *pResult, void *pUserData); static void ConSetJumps(IConsole::IResult *pResult, void *pUserData); static void ConWeapons(IConsole::IResult *pResult, void *pUserData); static void ConUnShotgun(IConsole::IResult *pResult, void *pUserData); static void ConUnGrenade(IConsole::IResult *pResult, void *pUserData); static void ConUnLaser(IConsole::IResult *pResult, void *pUserData); static void ConUnJetpack(IConsole::IResult *pResult, void *pUserData); + static void ConUnEndlessJump(IConsole::IResult *pResult, void *pUserData); static void ConUnWeapons(IConsole::IResult *pResult, void *pUserData); static void ConAddWeapon(IConsole::IResult *pResult, void *pUserData); static void ConRemoveWeapon(IConsole::IResult *pResult, void *pUserData); @@ -488,12 +490,14 @@ private: static void ConPracticeGrenade(IConsole::IResult *pResult, void *pUserData); static void ConPracticeLaser(IConsole::IResult *pResult, void *pUserData); static void ConPracticeJetpack(IConsole::IResult *pResult, void *pUserData); + static void ConPracticeEndlessJump(IConsole::IResult *pResult, void *pUserData); static void ConPracticeSetJumps(IConsole::IResult *pResult, void *pUserData); static void ConPracticeWeapons(IConsole::IResult *pResult, void *pUserData); static void ConPracticeUnShotgun(IConsole::IResult *pResult, void *pUserData); static void ConPracticeUnGrenade(IConsole::IResult *pResult, void *pUserData); static void ConPracticeUnLaser(IConsole::IResult *pResult, void *pUserData); static void ConPracticeUnJetpack(IConsole::IResult *pResult, void *pUserData); + static void ConPracticeUnEndlessJump(IConsole::IResult *pResult, void *pUserData); static void ConPracticeUnWeapons(IConsole::IResult *pResult, void *pUserData); static void ConPracticeNinja(IConsole::IResult *pResult, void *pUserData); static void ConPracticeUnNinja(IConsole::IResult *pResult, void *pUserData);