Skip to content

Commit

Permalink
Merge pull request ddnet#9520 from heinrich5991/pr_ddnet_revert_9518
Browse files Browse the repository at this point in the history
Revert "Add chat command afk"
  • Loading branch information
def- authored Jan 13, 2025
2 parents 6d09979 + 75ed9d2 commit d3442aa
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 32 deletions.
12 changes: 0 additions & 12 deletions src/game/server/ddracechat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1442,18 +1442,6 @@ void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData)
}
}

void CGameContext::ConAfk(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!CheckClientId(pResult->m_ClientId))
return;

CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientId];
if(!pPlayer)
return;
pPlayer->ForceAfk();
}

void CGameContext::ConNinjaJetpack(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
Expand Down
1 change: 0 additions & 1 deletion src/game/server/gamecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3766,7 +3766,6 @@ void CGameContext::RegisterChatCommands()
Console()->Register("rules", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRules, this, "Shows the server rules");
Console()->Register("emote", "?s[emote name] i[duration in seconds]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConEyeEmote, this, "Sets your tee's eye emote");
Console()->Register("eyeemote", "?s['on'|'off'|'toggle']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConSetEyeEmote, this, "Toggles use of standard eye-emotes on/off, eyeemote s, where s = on for on, off for off, toggle for toggle and nothing to show current status");
Console()->Register("afk", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConAfk, this, "Marks your tee as AFK (Away From Keyboard).");
Console()->Register("settings", "?s[configname]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConSettings, this, "Shows gameplay information for this server");
Console()->Register("help", "?r[command]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConHelp, this, "Shows help to command r, general help if left blank");
Console()->Register("info", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConInfo, this, "Shows info about this server");
Expand Down
1 change: 0 additions & 1 deletion src/game/server/gamecontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ class CGameContext : public IGameServer
static void ConConverse(IConsole::IResult *pResult, void *pUserData);
static void ConSetEyeEmote(IConsole::IResult *pResult, void *pUserData);
static void ConEyeEmote(IConsole::IResult *pResult, void *pUserData);
static void ConAfk(IConsole::IResult *pResult, void *pUserData);
static void ConShowOthers(IConsole::IResult *pResult, void *pUserData);
static void ConShowAll(IConsole::IResult *pResult, void *pUserData);
static void ConSpecTeam(IConsole::IResult *pResult, void *pUserData);
Expand Down
17 changes: 1 addition & 16 deletions src/game/server/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ void CPlayer::Reset()

m_DefEmote = EMOTE_NORMAL;
m_Afk = true;
m_ForceAfkTime = 0;
m_LastWhisperTo = -1;
m_LastSetSpectatorMode = 0;
m_aTimeoutCode[0] = '\0';
Expand Down Expand Up @@ -727,15 +726,7 @@ void CPlayer::UpdatePlaytime()

void CPlayer::AfkTimer()
{
if(m_ForceAfkTime == 0 || m_ForceAfkTime < time_get())
{
m_ForceAfkTime = 0;
SetAfk(g_Config.m_SvMaxAfkTime != 0 && m_LastPlaytime < time_get() - time_freq() * g_Config.m_SvMaxAfkTime);
}
else
{
m_LastPlaytime = time_get() - time_freq() * g_Config.m_SvMaxAfkTime - 1;
}
SetAfk(g_Config.m_SvMaxAfkTime != 0 && m_LastPlaytime < time_get() - time_freq() * g_Config.m_SvMaxAfkTime);
}

void CPlayer::SetAfk(bool Afk)
Expand Down Expand Up @@ -764,12 +755,6 @@ void CPlayer::SetInitialAfk(bool Afk)
m_LastPlaytime = time_get();
}

void CPlayer::ForceAfk()
{
m_ForceAfkTime = time_get() + time_freq();
SetInitialAfk(true);
}

int CPlayer::GetDefaultEmote() const
{
if(m_OverrideEmoteReset >= 0)
Expand Down
2 changes: 0 additions & 2 deletions src/game/server/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class CPlayer
int64_t m_ForcePauseTime;
int64_t m_LastPause;
bool m_Afk;
int64_t m_ForceAfkTime;

int m_DefEmote;
int m_OverrideEmote;
Expand Down Expand Up @@ -206,7 +205,6 @@ class CPlayer
void AfkTimer();
void SetAfk(bool Afk);
void SetInitialAfk(bool Afk);
void ForceAfk();
bool IsAfk() const { return m_Afk; }

int64_t m_LastPlaytime;
Expand Down

0 comments on commit d3442aa

Please sign in to comment.