Add a method to get a table of default callbacks
Add a method to get a table of default callbacks
This makes it possible for an add-on to create a waypoint with custom callbacks without losing the tooltip/onclick functionality that currently exists in TomTom. Usage is something like this:
local opts = {} -- any options for your waypoint, such as title, etc.
opts.callbacks = TomTom:DefaultCallbacks()
opts.callbacks.distance[15] = function(event, uid, range, distance, lastdistance)
-- this function will be called when the player moves from
-- outside 15 yards to within, or vide-versa and passed
-- several parameters
--
-- event: "distance"
-- uid: the UID of the waypoint
-- range: the callback range being triggered (15 in this case)
-- distance: the current distance to the waypoint
-- this MAY be less than 15, if you move really fast
-- lastdistance: the previous distance to the waypoint. This
-- can be used to determine whether or not you are
-- leaving the circle or entering it.
if not lastdistance or lastdistance and lastdistance > dist then
-- entering circle
else
-- exiting circle
end
end