1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Separate anticheat settings (#15040)

This commit is contained in:
Zemtzov7 2024-10-11 15:01:22 +05:00 committed by GitHub
parent d2b4c27f21
commit 1b2d24791a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 47 additions and 8 deletions

View file

@ -1011,12 +1011,12 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
/*
Check that target is reasonably close
*/
static thread_local const bool enable_anticheat =
!g_settings->getBool("disable_anticheat");
static thread_local const u32 anticheat_flags =
g_settings->getFlagStr("anticheat_flags", flagdesc_anticheat, nullptr);
if ((action == INTERACT_START_DIGGING || action == INTERACT_DIGGING_COMPLETED ||
action == INTERACT_PLACE || action == INTERACT_USE) &&
enable_anticheat && !isSingleplayer()) {
(anticheat_flags & AC_INTERACTION) && !isSingleplayer()) {
v3f target_pos = player_pos;
if (pointed.type == POINTEDTHING_NODE) {
target_pos = intToFloat(pointed.node_undersurface, BS);
@ -1119,7 +1119,7 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
/* Cheat prevention */
bool is_valid_dig = true;
if (enable_anticheat && !isSingleplayer()) {
if ((anticheat_flags & AC_DIGGING) && !isSingleplayer()) {
v3s16 nocheat_p = playersao->getNoCheatDigPos();
float nocheat_t = playersao->getNoCheatDigTime();
playersao->noCheatDigEnd();