Under water
AXIOM NAV swims for you, but never decides about breath. Your plugin reads get_water() and says when to go up.
Dive to a chest on the sea floor
-- swim = "bottom" is the default: it swims the straight slant down,
-- and into a sunken ship or a cave through its opening
client:move_to(chest_pos, function(ok, reason)
if ok then open_the_chest() end
end)Use move_to, never move_direct, under water: a straight line swims into the hull.
Watch the breath
local MARGIN_MS = 6000
core.register_on_update_callback(function()
local client = _G.AXIOM_NAV and _G.AXIOM_NAV.client
if not client then return end
local w = client:get_water()
if not w.submerged or not w.breath_ms or not w.up_ms or w.swimming_up_down then return end
-- up_ms is straight up at swim speed, with no margin: add your own
if w.breath_ms < w.up_ms * 1.5 + MARGIN_MS then
client:swim_up(function(ok, code)
-- "surfaced": breathe, then send your move_to again
core.log("swim up: " .. tostring(code))
end)
end
end)Stay on the surface
client:move_to(spot_beyond_the_bay, on_done, { swim = "surface" }) -- never dives
client:move_to(far_shore, on_done, { filter_water = 10 }) -- prefer the shore, swim only if much shorterUp and down by hand
| Call | Does |
|---|---|
client:swim_up(done, { z = 5 }) | Straight up to height 5, or the surface |
client:swim_down(nil, done) | Straight down to the floor |
client:swim_down(-20, done) | Straight down to height -20 |
Both stop a walk under way first. Any new walk or stop() cancels them with cancelled.