Skip to content

Commit de0ee6a

Browse files
fix
1 parent f7bd7f0 commit de0ee6a

2 files changed

Lines changed: 49 additions & 18 deletions

File tree

Cheater_Detection/detectors/double_tap.lua

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ local DT_EVIDENCE_COOLDOWN_S = 0.5
3636
local REJECT_LOG_INTERVAL_S = 0.35
3737
local HURT_LOG_INTERVAL_S = 1.0
3838
local WATCH_BURST_SCAN_INTERVAL = 4 -- ticks between scans while waiting for post-hit burst
39+
local ROUTINE_BURST_SCAN_INTERVAL = 8 -- idle background: deep scan only every N ticks
40+
local ROUTINE_MIN_VEL2D = 15 -- standing on ground: skip routine DT scan entirely
3941
local MAX_HURT_BURST_SCANS_TICK = 10 -- routine cap per game tick (busy fights)
4042
local MAX_HURT_BURST_SCANS_HOT = 14 -- absolute cap; hot shooters may exceed routine budget
4143

@@ -267,7 +269,18 @@ local function getDtEvidenceCap()
267269
return cap
268270
end
269271

270-
local function getDtFocusPriority(id)
272+
local function isStandingIdle(pdata)
273+
if not pdata or pdata.onGround == false then
274+
return false
275+
end
276+
local vel = pdata.velocity
277+
if not vel then
278+
return false
279+
end
280+
return vel:Length2D() <= ROUTINE_MIN_VEL2D
281+
end
282+
283+
local function getDtFocusPriority(id, pdata)
271284
if not id or id:sub(1, 4) == "BOT_" then
272285
return -1
273286
end
@@ -286,6 +299,10 @@ local function getDtFocusPriority(id)
286299
if weight > 0 then
287300
return DT_FOCUS_PRIORITY_SUSPECT
288301
end
302+
-- No hurt/watch/burst: do not routine-scan players just standing on ground.
303+
if pdata and isStandingIdle(pdata) then
304+
return -1
305+
end
289306
return DT_FOCUS_PRIORITY_ROUTINE
290307
end
291308

@@ -347,7 +364,7 @@ function DoubleTap.BeginDetectionTick(activePlayers, curTick)
347364
if not id then
348365
goto continue
349366
end
350-
local priority = getDtFocusPriority(id)
367+
local priority = getDtFocusPriority(id, pState.pdata)
351368
if priority == DT_FOCUS_PRIORITY_WATCH or priority == DT_FOCUS_PRIORITY_BURST then
352369
hotPool[#hotPool + 1] = id
353370
elseif priority == DT_FOCUS_PRIORITY_SUSPECT then
@@ -569,18 +586,25 @@ local function onBurstDetected(id, burstAmount, curTick, burstIndex)
569586
end
570587
end
571588

572-
local function shouldScanBurstThisTick(id, curTick)
573-
if isFocusedPlayer(id) and getDtFocusPriority(id) >= DT_FOCUS_PRIORITY_BURST then
589+
local function shouldScanBurstThisTick(id, curTick, pdata)
590+
local priority = getDtFocusPriority(id, pdata)
591+
if priority == DT_FOCUS_PRIORITY_BURST then
574592
return true
575593
end
576-
if not isWatchingForBurst(id) then
577-
return true
594+
if priority == DT_FOCUS_PRIORITY_WATCH then
595+
return (curTick % WATCH_BURST_SCAN_INTERVAL) == 0
578596
end
579-
return (curTick % WATCH_BURST_SCAN_INTERVAL) == 0
597+
if priority == DT_FOCUS_PRIORITY_SUSPECT then
598+
return (curTick % WATCH_BURST_SCAN_INTERVAL) == 0
599+
end
600+
if priority ~= DT_FOCUS_PRIORITY_ROUTINE then
601+
return false
602+
end
603+
return (curTick % ROUTINE_BURST_SCAN_INTERVAL) == 0
580604
end
581605

582-
local function tryDetectBurstForPlayer(id, curTick, forceScan)
583-
if not forceScan and not shouldScanBurstThisTick(id, curTick) then
606+
local function tryDetectBurstForPlayer(id, curTick, forceScan, pdata)
607+
if not forceScan and not shouldScanBurstThisTick(id, curTick, pdata) then
584608
return
585609
end
586610

@@ -628,7 +652,7 @@ local function tryHurtBurstScan(id, curTick, wasWatchingBeforeHurt)
628652
end
629653
data.lastHurtBurstScanTick = curTick
630654
hurtBurstScansUsed = hurtBurstScansUsed + 1
631-
tryDetectBurstForPlayer(id, curTick, true)
655+
tryDetectBurstForPlayer(id, curTick, true, nil)
632656
end
633657

634658
function DoubleTap.HasWork(playerState)
@@ -639,10 +663,17 @@ function DoubleTap.HasWork(playerState)
639663
return false
640664
end
641665
local id = playerState.id
642-
if getDtFocusPriority(id) < 0 then
666+
if not isFocusedPlayer(id) then
667+
return false
668+
end
669+
local pdata = playerState.pdata
670+
if getDtFocusPriority(id, pdata) < 0 then
671+
return false
672+
end
673+
if not shouldScanBurstThisTick(id, globals.TickCount(), pdata) then
643674
return false
644675
end
645-
return isFocusedPlayer(id)
676+
return true
646677
end
647678

648679
function DoubleTap.ProcessPlayer(playerState)
@@ -676,7 +707,7 @@ function DoubleTap.ProcessPlayer(playerState)
676707

677708
local curTick = globals.TickCount()
678709
clearStaleBurstState(getState(id), curTick)
679-
tryDetectBurstForPlayer(id, curTick)
710+
tryDetectBurstForPlayer(id, curTick, false, playerState.pdata)
680711
end
681712

682713
function DoubleTap.Tick()

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ We have completely re-engineered the backend storage and in-memory execution pip
6969

7070
Every push to `main` triggers [`.github/workflows/release.yml`](.github/workflows/release.yml): embedded DBs are rebuilt, Lua is bundled, a semver tag is bumped from the **first line of the commit message**, and a GitHub Release is published with:
7171

72-
| Bump | Version change | Keywords in commit (examples) |
73-
|------|----------------|--------------------------------|
74-
| **patch** (default) | `+0.0.1` | `fix`, `perf`, `patch`, `hotfix` — or no keyword |
75-
| **minor** | `+0.1.0` (patch reset to 0) | `minor`, `feat`, `feature`, `update` |
76-
| **major** | `+1.0.0` (minor/patch reset) | `major`, `breaking`, `break` |
72+
| Bump | Version change | Keywords in commit (examples) |
73+
| ------------------- | ---------------------------- | ------------------------------------------------ |
74+
| **patch** (default) | `+0.0.1` | `fix`, `perf`, `patch`, `hotfix` — or no keyword |
75+
| **minor** | `+0.1.0` (patch reset to 0) | `minor`, `feat`, `feature`, `update` |
76+
| **major** | `+1.0.0` (minor/patch reset) | `major`, `breaking`, `break` |
7777

7878
Example: `v1.4.2` + commit `perf: faster bhop gate``v1.4.3`. Commit `update: new detections``v1.5.0`. Commit `major: rewrite evidence``v2.0.0`.
7979

0 commit comments

Comments
 (0)