defer stopattack to the next frame

This commit is contained in:
Jrc13245
2026-03-06 20:21:42 -05:00
parent 52b831c2c2
commit 720246e473
2 changed files with 49 additions and 35 deletions
+3 -12
View File
@@ -111,18 +111,9 @@ local StartAttack = function(msg)
end
local StopAttack = function(msg)
-- Clear target and retarget to reliably stop autoattack.
-- AttackTarget() toggle is too slow — CastSpellByName starts autoattack as a side effect
-- but PLAYER_ENTER_COMBAT hasn't fired yet in the same frame, so the toggle misses it.
-- ClearTarget() immediately drops the target (stopping any pending swing),
-- and TargetLastTarget() restores it without restarting autoattack.
CleveRoids.CurrentSpell.autoAttack = false
CleveRoids.CurrentSpell.autoAttackLock = false
if UnitExists("target") then
AttackTarget()
ClearTarget()
TargetLastTarget()
end
-- Deferred to next frame because CastSpellByName starts autoattack as a C++
-- side-effect that hasn't settled yet — AttackTarget() toggle misses it.
CleveRoids.DeferStopAttack()
end
-- Register slash commands and assign original handlers.