Skip to content

sdk.navigator ​

Stateful one-tile movement controller. Prevents walk queue flooding, remembers temporarily blocked tiles, and suppresses immediate direction reversals that cause left/right oscillation.

lua
local M = require("sdk.navigator")

Constants ​

Lua 5.4 has no enums — these are integer (or string) fields on the module.

NameValueSummary
oppositeOPPOSITEMap of each direction to its opposite.

new ​

function · new(opts)

Returns Navigator.

Parameters

NameTypeSummary
optstable|niltimeout_ms=1400, block_ms=3500, reverse_guard_ms=900

Returns

TypeSummary
Navigator—

reset ​

method · reset()

Clear pending walk, blocks, and reverse-guard memory. Call on plan swap / logout; do not keep another cave's blocks. Does not walk-stop; the caller must halt movement.

observe ​

method · observe(here, now)

Call every tick before step(). Returns "moved" | "diverted" | "blocked" | "moving".

Parameters

NameTypeSummary
herePos—
nownumberepoch ms

is_moving ​

method · is_moving()

True while a walk packet is outstanding. step() refuses a second send until observe() clears pending. Not the same as 'standing'; diverted still clears pending.

last_direction ​

method · last_direction()

Last completed walk direction, or nil. Reverse guard compares against this per context. Cleared by reset(), not by a failed send.

is_blocked ​

method · is_blocked(p, now)

True if p is still inside its block_ms window. now==0 treats any stored block as live. Prunes first so callers need not.

blocked ​

method · blocked(now)

List of currently blocked tiles as positions. Order is map iteration; do not depend on it. Used by pathing to paint avoid cells.

step ​

method · step(me, here, dir, now, context)

Sends at most one pending walk. Same-context reverse within reverse_guard_ms is "reverse".

Parameters

NameTypeSummary
meLocalPlayer—
herePos—
dirstring|integer—
nownumber—
contextstring|nilhunt/loot/search/... — reverse guard is per context

Returns

TypeSummary
boolean|nilok
string|nilerr one of: no player, stop, moving, blocked, reverse, walk failed

Arcane SDK catalog generated from scripts/sdk