@@ -36,6 +36,8 @@ local DT_EVIDENCE_COOLDOWN_S = 0.5
3636local REJECT_LOG_INTERVAL_S = 0.35
3737local HURT_LOG_INTERVAL_S = 1.0
3838local 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
3941local MAX_HURT_BURST_SCANS_TICK = 10 -- routine cap per game tick (busy fights)
4042local 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
268270end
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
290307end
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
570587end
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
580604end
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 )
632656end
633657
634658function 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
646677end
647678
648679function 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 )
680711end
681712
682713function DoubleTap .Tick ()
0 commit comments