From c91be7b19f43f51649cde61317df3718f1789910 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 26 Sep 2024 19:07:37 +0200 Subject: [PATCH] Add practice command /invincible to toggle invincible mode --- src/game/server/ddracechat.cpp | 7 +++++++ src/game/server/gamecontext.cpp | 1 + src/game/server/gamecontext.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 63c9137d7..63db4bdff 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -2167,6 +2167,13 @@ void CGameContext::ConPracticeUnNinja(IConsole::IResult *pResult, void *pUserDat ConUnNinja(pResult, pUserData); } +void CGameContext::ConPracticeToggleInvincible(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + if(pSelf->GetPracticeCharacter(pResult)) + ConToggleInvincible(pResult, pUserData); +} + void CGameContext::ConPracticeAddWeapon(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 73606fcac..55164d835 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3821,6 +3821,7 @@ 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("invincible", "?i['0'|'1']", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeToggleInvincible, this, "Toggles invincible mode"); 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 dce2499dc..4d402175d 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -493,6 +493,7 @@ private: static void ConPracticeUnWeapons(IConsole::IResult *pResult, void *pUserData); static void ConPracticeNinja(IConsole::IResult *pResult, void *pUserData); static void ConPracticeUnNinja(IConsole::IResult *pResult, void *pUserData); + static void ConPracticeToggleInvincible(IConsole::IResult *pResult, void *pUserData); static void ConPracticeAddWeapon(IConsole::IResult *pResult, void *pUserData); static void ConPracticeRemoveWeapon(IConsole::IResult *pResult, void *pUserData);