From 75ed9d21035c6dd636578f323603c320a562af6d Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Mon, 13 Jan 2025 10:20:47 +0100 Subject: [PATCH] Revert "Add chat command afk" This reverts commit 4bac7d6c4182300d035377744954754fde79c099. It was merged without even referencing the discussion about whether it should be included or not. --- src/game/server/ddracechat.cpp | 12 ------------ src/game/server/gamecontext.cpp | 1 - src/game/server/gamecontext.h | 1 - src/game/server/player.cpp | 17 +---------------- src/game/server/player.h | 2 -- 5 files changed, 1 insertion(+), 32 deletions(-) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index cf4e43f2df3..680079c68c9 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -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; diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 61a1249360c..57acc45a4b4 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -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"); diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 6d40a23ba56..c5e6b19f83b 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -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); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 3e200063718..2d2659c3ef3 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -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'; @@ -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) @@ -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) diff --git a/src/game/server/player.h b/src/game/server/player.h index ddf92755823..6ca1610c26f 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -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; @@ -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;