rangecheck: rewrite of the 40y range check

* remove the bad notice in GUI
* set default interval to "2"
* prevent all frames of being updated at once
* refresh one unit after the other
* use textures insted of spellnames
* change interval settings to dropdown
* remove no longer required locales
This commit is contained in:
shagu
2017-12-31 17:41:18 +01:00
parent f2543d71af
commit 7e8f2fbb4c
12 changed files with 157 additions and 97 deletions
+5 -26
View File
@@ -17,7 +17,8 @@ function pfUI.api.strsplit(delimiter, subject)
end
-- [ UnitInRange ]
-- Returns whether a party/raid member is nearby. It uses spells with a distance of around 40 yards.
-- Returns whether a party/raid member is nearby.
-- It takes care of the rangecheck module if existing.
-- unit [string] A unit to query (string, unitID)
-- return: [bool] "1" if in range otherwise "nil"
local RangeCache = {}
@@ -28,32 +29,10 @@ function pfUI.api.UnitInRange(unit)
if CheckInteractDistance(unit, 4) then
return 1
else if not pfUI.rangecheck or not pfUI.rangecheck.slot then
return nil
else if pfUI.rangecheck then
return pfUI.rangecheck:UnitInSpellRange(unit)
else
-- Extended Range Check
if not RangeCache[unit] or RangeCache[unit].time + pfUI.rangecheck.interval < GetTime() then
RangeCache[unit] = {}
RangeCache[unit].time = GetTime()
if not UnitIsUnit("target", unit) then
pfScanActive = true
TargetUnit(unit)
end
if IsActionInRange(pfUI.rangecheck.slot) == 1 then
RangeCache[unit].range = 1
else
RangeCache[unit].range = nil
end
if pfScanActive then
TargetLastTarget()
pfScanActive = false
end
end
return RangeCache[unit].range
return nil
end
end
end