From 1f5d2be2169562a3f810e43e9627e1732f7f18d4 Mon Sep 17 00:00:00 2001 From: James Whitehead Ii Date: Thu, 11 Oct 2007 13:28:04 +0000 Subject: [PATCH] * Waypoints now automatically disappear when you are within 10 yards (this is just to gain compat with the old TomTom). * Waypoints will automatically be set as a crazy taxi arrow with the last one taking the arrow. --- TomTom.lua | 9 ++++++++- TomTom_Waypoints.lua | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index 3aaa951..06b57f4 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -130,6 +130,13 @@ function WorldMapButton_OnClick(...) end end +local function WaypointCallback(event, data, dist, lastdist) + TomTom:Print(event, data, dist, lastdist) + if event == "OnDistanceArrive" then + TomTom:ClearWaypoint(data) + end +end + -- TODO: Make this now suck function TomTom:AddWaypoint(x,y,desc) local oc,oz = Astrolabe:GetCurrentPlayerPosition() @@ -144,7 +151,7 @@ function TomTom:AddWaypoint(x,y,desc) return end - local point = self:SetWaypoint(c,z,x,y) + local point = self:SetWaypoint(c, z, x, y, nil, nil, 10, WaypointCallback) self:SetCrazyArrow(point, 15) end --[[ diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua index 0f64253..6ebdebb 100644 --- a/TomTom_Waypoints.lua +++ b/TomTom_Waypoints.lua @@ -118,6 +118,21 @@ function TomTom:SetWaypoint(c,z,x,y,far,near,arrive,callback) return point end +function TomTom:ClearWaypoint(point) + point.c = nil + point.z = nil + point.x = nil + point.y = nil + point.far = nil + point.near = nil + point.arrive = nil + point.callback = nil + + Astrolabe:RemoveIconFromMinimap(point.minimap) + point.world:Hide() + table.insert(pool, point) +end + do local tooltip_icon,tooltip_callback @@ -206,7 +221,6 @@ do end if callback then - -- Handle the logic/callbacks for arrival local dist,x,y = Astrolabe:GetDistanceToIcon(self) local near,far,arrive = data.near,data.far,data.arrive @@ -234,7 +248,7 @@ do elseif far and dist <= far then newstate = 3 else - state = 4 + newstate = 4 end if state ~= newstate then -- 1.7.9.5