Quantcast

Enforce conditions on arrivaldistance and cleardistance if user has set arrow.enablePing.

Ludovicus [07-05-19 - 18:29]
Enforce conditions on arrivaldistance and cleardistance if user has set arrow.enablePing.
Filename
TomTom.lua
diff --git a/TomTom.lua b/TomTom.lua
index cf723ec..2e5a7c3 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -832,6 +832,16 @@ function TomTom:DefaultCallbacks(opts)
         arrivaldistance = opts.arrivaldistance
     end

+    -- User wants ping, they get ping!
+    if TomTom.profile.arrow.enablePing then
+        if arrivaldistance <= 0 then
+            arrivaldistance = 1
+        end
+        if arrivaldistance < cleardistance then
+            arrivaldistance = cleardistance
+        end
+    end
+
     if cleardistance == arrivaldistance then
         callbacks.distance[cleardistance] = function(...)
             _both_clear_distance(...);