mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 11:10:00 +00:00
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:
+5
-26
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user