feat: Add cheat detection knowledge (#2034)

* feat: Add cheat detection knowledge

tested that getting kicked correctly displays the reasons why and their corresponding values
tested that a user with developer permissions is not kicked for said funness
tested that logs are correct for those funness values which i could actually trigger

* fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
David Markowitz
2026-09-18 02:30:59 -07:00
committed by GitHub
parent 8f2004c9a3
commit 057de71773
4 changed files with 89 additions and 9 deletions

View File

@@ -9,6 +9,7 @@
#include "eGameMasterLevel.h"
#include "BitStreamUtils.h"
#include "MessageType/Chat.h"
#include "StringifiedEnum.h"
#include <chrono>
#include <ctime>
@@ -127,11 +128,16 @@ void User::SetMuteExpire(time_t value) {
m_MuteExpire = value;
}
void User::UserOutOfSync() {
void User::UserOutOfSync(const CaughtFunness& funness) {
m_CaughtFunness.push_back(funness);
m_AmountOfTimesOutOfSync++;
if (m_AmountOfTimesOutOfSync > m_MaxDesyncAllowed) {
//YEET
LOG("User %s was out of sync %i times out of %i, disconnecting for suspected speedhacking.", m_Username.c_str(), m_AmountOfTimesOutOfSync, m_MaxDesyncAllowed);
LOG("User %s was out of sync %i times out of %i, disconnecting for the following reasons: {", m_Username.c_str(), m_AmountOfTimesOutOfSync, m_MaxDesyncAllowed);
for (const auto [cheatType, cheatInfo] : m_CaughtFunness) {
LOG(" Reason %s value %f", StringifiedEnum::ToString(cheatType).data(), cheatInfo);
}
LOG("}");
Game::server->Disconnect(this->m_SystemAddress, eServerDisconnectIdentifiers::PLAY_SCHEDULE_TIME_DONE);
}
}