diff --git a/src/game/ddracecommands.h b/src/game/ddracecommands.h index 18be97bc4..19e29565d 100644 --- a/src/game/ddracecommands.h +++ b/src/game/ddracecommands.h @@ -27,6 +27,8 @@ CONSOLE_COMMAND("unweapons", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnWeapons, th CONSOLE_COMMAND("ninja", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConNinja, this, "Makes you a ninja") CONSOLE_COMMAND("super", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConSuper, this, "Makes you super") CONSOLE_COMMAND("unsuper", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnSuper, this, "Removes super from you") +CONSOLE_COMMAND("endless_hook", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConEndlessHook, this, "Gives you endless hook") +CONSOLE_COMMAND("unendless_hook", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnEndlessHook, this, "Removes endless hook from you") CONSOLE_COMMAND("unsolo", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnSolo, this, "Puts you out of solo part") CONSOLE_COMMAND("undeep", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConUnDeep, this, "Puts you out of deep freeze") CONSOLE_COMMAND("left", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConGoLeft, this, "Makes you move 1 tile left") diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index 8ff0a3bd2..fe24381fc 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -94,6 +94,30 @@ void CGameContext::ConNinja(IConsole::IResult *pResult, void *pUserData) pSelf->ModifyWeapons(pResult, pUserData, WEAPON_NINJA, false); } +void CGameContext::ConEndlessHook(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->SetEndlessHook(true); + } +} + +void CGameContext::ConUnEndlessHook(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->SetEndlessHook(false); + } +} + void CGameContext::ConSuper(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 bd1f37b39..4fffa4337 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1606,17 +1606,13 @@ void CCharacter::HandleTiles(int Index) m_DeepFreeze = false; // endless hook - if(((m_TileIndex == TILE_EHOOK_ENABLE) || (m_TileFIndex == TILE_EHOOK_ENABLE)) && !m_EndlessHook) + if(((m_TileIndex == TILE_EHOOK_ENABLE) || (m_TileFIndex == TILE_EHOOK_ENABLE))) { - GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Endless hook has been activated"); - m_EndlessHook = true; - m_Core.m_EndlessHook = true; + SetEndlessHook(true); } - else if(((m_TileIndex == TILE_EHOOK_DISABLE) || (m_TileFIndex == TILE_EHOOK_DISABLE)) && m_EndlessHook) + else if(((m_TileIndex == TILE_EHOOK_DISABLE) || (m_TileFIndex == TILE_EHOOK_DISABLE))) { - GameServer()->SendChatTarget(GetPlayer()->GetCID(), "Endless hook has been deactivated"); - m_EndlessHook = false; - m_Core.m_EndlessHook = false; + SetEndlessHook(false); } // hit others @@ -2355,6 +2351,18 @@ void CCharacter::GiveAllWeapons() } } +void CCharacter::SetEndlessHook(bool Enable) +{ + if(m_EndlessHook == Enable) + { + return; + } + + GameServer()->SendChatTarget(GetPlayer()->GetCID(), Enable ? "Endless hook has been activated" : "Endless hook has been deactived"); + m_EndlessHook = Enable; + m_Core.m_EndlessHook = Enable; +} + void CCharacter::Pause(bool Pause) { m_Paused = Pause; diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index 4342108df..c7cdf8116 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -82,6 +82,7 @@ public: void GiveWeapon(int Weapon, bool Remove = false); void GiveNinja(); void RemoveNinja(); + void SetEndlessHook(bool Enable); void SetEmote(int Emote, int Tick); diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 99bf25ca3..e0637dcde 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -297,6 +297,8 @@ private: static void ConKillPlayer(IConsole::IResult *pResult, void *pUserData); static void ConNinja(IConsole::IResult *pResult, void *pUserData); + static void ConEndlessHook(IConsole::IResult *pResult, void *pUserData); + static void ConUnEndlessHook(IConsole::IResult *pResult, void *pUserData); static void ConUnSolo(IConsole::IResult *pResult, void *pUserData); static void ConUnDeep(IConsole::IResult *pResult, void *pUserData); static void ConUnSuper(IConsole::IResult *pResult, void *pUserData);