diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 4a927d757..1741cbe44 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -2001,6 +2001,46 @@ CCharacter *CGameContext::GetPracticeCharacter(IConsole::IResult *pResult) return pChr; } +void CGameContext::ConPracticeToTeleporter(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + CCharacter *pChr = pSelf->GetPracticeCharacter(pResult); + if(pChr) + { + if(pSelf->Collision()->TeleOuts(pResult->GetInteger(0) - 1).empty()) + { + pSelf->SendChatTarget(pChr->GetPlayer()->GetCid(), "There is no teleporter with that index on the map."); + return; + } + + ConToTeleporter(pResult, pUserData); + pChr->ResetJumps(); + pChr->UnFreeze(); + pChr->ResetVelocity(); + pChr->GetPlayer()->m_LastTeleTee.Save(pChr); + } +} + +void CGameContext::ConPracticeToCheckTeleporter(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + CCharacter *pChr = pSelf->GetPracticeCharacter(pResult); + if(pChr) + { + if(pSelf->Collision()->TeleCheckOuts(pResult->GetInteger(0) - 1).empty()) + { + pSelf->SendChatTarget(pChr->GetPlayer()->GetCid(), "There is no checkpoint teleporter with that index on the map."); + return; + } + + ConToCheckTeleporter(pResult, pUserData); + pChr->ResetJumps(); + pChr->UnFreeze(); + pChr->ResetVelocity(); + pChr->GetPlayer()->m_LastTeleTee.Save(pChr); + } +} + void CGameContext::ConPracticeUnSolo(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; @@ -2078,6 +2118,26 @@ void CGameContext::ConPracticeDeep(IConsole::IResult *pResult, void *pUserData) pChr->SetDeepFrozen(true); } +void CGameContext::ConPracticeUnLiveFreeze(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + auto *pChr = pSelf->GetPracticeCharacter(pResult); + if(!pChr) + return; + + pChr->SetLiveFrozen(false); +} + +void CGameContext::ConPracticeLiveFreeze(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + auto *pChr = pSelf->GetPracticeCharacter(pResult); + if(!pChr) + return; + + pChr->SetLiveFrozen(true); +} + void CGameContext::ConPracticeShotgun(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; @@ -2169,6 +2229,20 @@ void CGameContext::ConPracticeUnNinja(IConsole::IResult *pResult, void *pUserDat ConUnNinja(pResult, pUserData); } +void CGameContext::ConPracticeEndlessHook(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + if(pSelf->GetPracticeCharacter(pResult)) + ConEndlessHook(pResult, pUserData); +} + +void CGameContext::ConPracticeUnEndlessHook(IConsole::IResult *pResult, void *pUserData) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + if(pSelf->GetPracticeCharacter(pResult)) + ConUnEndlessHook(pResult, pUserData); +} + void CGameContext::ConPracticeToggleInvincible(IConsole::IResult *pResult, void *pUserData) { CGameContext *pSelf = (CGameContext *)pUserData; diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 55164d835..1a2e24d1f 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3669,8 +3669,8 @@ void CGameContext::OnConsoleInit() void CGameContext::RegisterDDRaceCommands() { Console()->Register("kill_pl", "v[id]", CFGFLAG_SERVER, ConKillPlayer, this, "Kills player v and announces the kill"); - Console()->Register("totele", "i[number]", CFGFLAG_SERVER | CMDFLAG_TEST, ConToTeleporter, this, "Teleports you to teleporter v"); - Console()->Register("totelecp", "i[number]", CFGFLAG_SERVER | CMDFLAG_TEST, ConToCheckTeleporter, this, "Teleports you to checkpoint teleporter v"); + Console()->Register("totele", "i[number]", CFGFLAG_SERVER | CMDFLAG_TEST, ConToTeleporter, this, "Teleports you to teleporter i"); + Console()->Register("totelecp", "i[number]", CFGFLAG_SERVER | CMDFLAG_TEST, ConToCheckTeleporter, this, "Teleports you to checkpoint teleporter i"); Console()->Register("tele", "?i[id] ?i[id]", CFGFLAG_SERVER | CMDFLAG_TEST, ConTeleport, this, "Teleports player i (or you) to player i (or you to where you look at)"); Console()->Register("addweapon", "i[weapon-id]", CFGFLAG_SERVER | CMDFLAG_TEST, ConAddWeapon, this, "Gives weapon with id i to you (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, laser = 4, ninja = 5)"); Console()->Register("removeweapon", "i[weapon-id]", CFGFLAG_SERVER | CMDFLAG_TEST, ConRemoveWeapon, this, "removes weapon with id i from you (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, laser = 4, ninja = 5)"); @@ -3800,10 +3800,14 @@ void CGameContext::RegisterChatCommands() Console()->Register("lasttp", "", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConLastTele, this, "Teleport yourself to the last location you teleported to"); Console()->Register("tc", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, 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 | CMDFLAG_PRACTICE, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given"); + Console()->Register("totele", "i[number]", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeToTeleporter, this, "Teleports you to teleporter i"); + Console()->Register("totelecp", "i[number]", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeToCheckTeleporter, this, "Teleports you to checkpoint teleporter i"); Console()->Register("unsolo", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnSolo, this, "Puts you out of solo part"); Console()->Register("solo", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeSolo, this, "Puts you into solo part"); Console()->Register("undeep", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnDeep, this, "Puts you out of deep freeze"); Console()->Register("deep", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeDeep, this, "Puts you into deep freeze"); + Console()->Register("unlivefreeze", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnLiveFreeze, this, "Puts you out of live freeze"); + Console()->Register("livefreeze", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeLiveFreeze, this, "Makes you live frozen"); Console()->Register("addweapon", "i[weapon-id]", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeAddWeapon, this, "Gives weapon with id i to you (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, laser = 4, ninja = 5)"); Console()->Register("removeweapon", "i[weapon-id]", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeRemoveWeapon, this, "removes weapon with id i from you (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, laser = 4, ninja = 5)"); Console()->Register("shotgun", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeShotgun, this, "Gives a shotgun to you"); @@ -3821,6 +3825,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("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"); 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 4d402175d..4551fbc1f 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -476,10 +476,14 @@ private: static void ConLastTele(IConsole::IResult *pResult, void *pUserData); // Chat commands for practice mode + static void ConPracticeToTeleporter(IConsole::IResult *pResult, void *pUserData); + static void ConPracticeToCheckTeleporter(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 ConPracticeUnLiveFreeze(IConsole::IResult *pResult, void *pUserData); + static void ConPracticeLiveFreeze(IConsole::IResult *pResult, void *pUserData); static void ConPracticeShotgun(IConsole::IResult *pResult, void *pUserData); static void ConPracticeGrenade(IConsole::IResult *pResult, void *pUserData); static void ConPracticeLaser(IConsole::IResult *pResult, void *pUserData); @@ -493,6 +497,8 @@ 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 ConPracticeEndlessHook(IConsole::IResult *pResult, void *pUserData); + static void ConPracticeUnEndlessHook(IConsole::IResult *pResult, void *pUserData); static void ConPracticeToggleInvincible(IConsole::IResult *pResult, void *pUserData); static void ConPracticeAddWeapon(IConsole::IResult *pResult, void *pUserData);