Events
For things you want to hear about while a walk is under way. The walk's own done function is still the way to
know how it ended; events are for what happens on the way.
Listen and stop listening
-- fn(data, event_name). owner: your plugin's table
client:on("stuck_detected", function(data) core.log("stuck, getting free") end, self)
client:on("arrived", function(data) core.log("there") end, self)
client:off(self) -- when your plugin stops: drops all of its listeners at once| Call | What it does |
|---|---|
client:on(name, fn, owner?) | Listen. Returns an id |
client:off(owner) | Drop all of owner's listeners |
client:off(id) | Drop one listener |
client:off(name, fn) | Drop one listener |
Each event's full name is axiom_nav.<name> (axiom_nav.arrived). client:on takes either.
The events
| Event | When | Data |
|---|---|---|
state_changed | Any change of state or sub-state | { from, to, substate_from, substate_to } |
arrived | The walk ended at its place | |
failed | The walk ended without getting there | |
stuck_detected | Stuck; it is getting free | |
stuck_recovered | Free again | |
deviation_detected | Pushed off the route | |
repath_started, repath_completed | A new route asked on the way, and its answer | |
obstacle_detected | Something on the route ahead | |
path_requested, path_received, path_failed | Route requests (retarget = true when a new move_to re-aimed the walk) | |
waypoint_reached | A point of the route passed | { index, total } |
dismount_needed | Mounted at the route's get-off point | { at, why, first_misfit, get_off, destination } |
ride_from | On foot with mount = true: where the route can be ridden from | { ride_from, index, why_not_before, ride, fits_from_here, rides, destination } |
mount_here | On foot at the get-on point, waiting for the mount | { at, index, why_not_before, ride, destination } |
server_connected, server_retry, server_disconnected, server_error | The route server |
No path_requested or path_received comes for a walk done by close-range direct steering: no route is asked.
The mount events
AXIOM NAV never mounts or dismounts. These two are your cue:
client:on("dismount_needed", function(d)
-- d.why: "indoors", "low", "narrow" or "no_mounts_area"
core.input.dismount() -- the walk goes on by itself once on foot
end, self)
client:on("mount_here", function(d)
-- after move_to(..., { mount = true }) on foot
cast_my_mount() -- your own mount cast; the walk rides on once mounted
end, self)States
client:get_state() answers the first word, client:get_state_detail() all of it.
| Top level | Sub-states |
|---|---|
idle | |
navigating | awaiting_path, following_path, repathing, deferred (waiting for a cast), recovering (jumping, probing, strafing, backtracking) |
arrived | |
failed |
Example: "navigating.recovering.strafing".