mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Merge #3445
3445: Add (un)endless_hook command r=heinrich5991 a=def- As requested by Kicker <!-- What is the motivation for the changes of this pull request --> ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [x] Tested in combination with possibly related configuration options - [x] Written a unit test if it works standalone, system.c especially - [x] Considered possible null pointers and out of bounds array indexing - [x] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
896881079f
|
@ -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("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("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("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("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("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")
|
CONSOLE_COMMAND("left", "", CFGFLAG_SERVER | CMDFLAG_TEST, ConGoLeft, this, "Makes you move 1 tile left")
|
||||||
|
|
|
@ -94,6 +94,30 @@ void CGameContext::ConNinja(IConsole::IResult *pResult, void *pUserData)
|
||||||
pSelf->ModifyWeapons(pResult, pUserData, WEAPON_NINJA, false);
|
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)
|
void CGameContext::ConSuper(IConsole::IResult *pResult, void *pUserData)
|
||||||
{
|
{
|
||||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
|
|
|
@ -1606,17 +1606,13 @@ void CCharacter::HandleTiles(int Index)
|
||||||
m_DeepFreeze = false;
|
m_DeepFreeze = false;
|
||||||
|
|
||||||
// endless hook
|
// 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");
|
SetEndlessHook(true);
|
||||||
m_EndlessHook = true;
|
|
||||||
m_Core.m_EndlessHook = 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");
|
SetEndlessHook(false);
|
||||||
m_EndlessHook = false;
|
|
||||||
m_Core.m_EndlessHook = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hit others
|
// 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)
|
void CCharacter::Pause(bool Pause)
|
||||||
{
|
{
|
||||||
m_Paused = Pause;
|
m_Paused = Pause;
|
||||||
|
|
|
@ -82,6 +82,7 @@ public:
|
||||||
void GiveWeapon(int Weapon, bool Remove = false);
|
void GiveWeapon(int Weapon, bool Remove = false);
|
||||||
void GiveNinja();
|
void GiveNinja();
|
||||||
void RemoveNinja();
|
void RemoveNinja();
|
||||||
|
void SetEndlessHook(bool Enable);
|
||||||
|
|
||||||
void SetEmote(int Emote, int Tick);
|
void SetEmote(int Emote, int Tick);
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,8 @@ private:
|
||||||
static void ConKillPlayer(IConsole::IResult *pResult, void *pUserData);
|
static void ConKillPlayer(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
||||||
static void ConNinja(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 ConUnSolo(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConUnDeep(IConsole::IResult *pResult, void *pUserData);
|
static void ConUnDeep(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConUnSuper(IConsole::IResult *pResult, void *pUserData);
|
static void ConUnSuper(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
Loading…
Reference in a new issue