From ff52bd32d35710cc590f762d54b0c1ce054084cf Mon Sep 17 00:00:00 2001 From: GryllsAddons <107083057+GryllsAddons@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:25:21 +0100 Subject: [PATCH] Add files via upload --- unitscan.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/unitscan.lua b/unitscan.lua index 330759e..d5fb707 100644 --- a/unitscan.lua +++ b/unitscan.lua @@ -14,7 +14,7 @@ unitscan:RegisterEvent'PLAYER_ENTERING_WORLD' local BROWN = {.7, .15, .05} local YELLOW = {1, 1, .15} -local CHECK_INTERVAL = .1 -- .1 +local CHECK_INTERVAL = 1 -- .1 unitscan_targets = {} @@ -55,6 +55,17 @@ function unitscan.restore_target() prevTarget = nil end +function unitscan.clear_target() + if prevTarget then + TargetLastTarget() + else + ClearTarget() + end + dead = nil + reaction = nil + prevTarget = nil +end + function unitscan.check_for_targets() for name, _ in unitscan_targets do if name == unitscan.target(name) then @@ -66,7 +77,8 @@ function unitscan.check_for_targets() unitscan.flash.animation:Play() unitscan.button:set_target() - unitscan.restore_target() + -- unitscan.restore_target() + unitscan.clear_target() end end end @@ -84,7 +96,8 @@ function unitscan.check_for_zonetargets() unitscan.button:set_target() end - unitscan.restore_target() + -- unitscan.restore_target() + unitscan.clear_target() end end end @@ -423,4 +436,4 @@ function SlashCmdList.UNITSCANTARGET() if unitscan.foundTarget then TargetByName(unitscan.foundTarget, true) end -end +end \ No newline at end of file