Repository navigation
v2.7.0 - Hook System for Pathfinding Lifecycle Events
What's New
Hook System
A comptime-based, zero-overhead hook system for observing pathfinding lifecycle events.
Algorithm Hooks (A*, Floyd-Warshall):
path_requested- When pathfinding is initiatedpath_found- When a valid path is discoveredno_path_found- When no path exists between nodesnode_visited- When a node is visited during search (for debugging/visualization)search_complete- When the search algorithm finishes
Stair/Movement Hooks (PathfindingEngine):
stair_enter- When an entity enters a stairstair_exit- When an entity exits a stairstair_wait- When an entity starts waiting for a stair (blocked by traffic)
Usage Example
const MyHooks = struct {
pub fn path_found(payload: pathfinding.hooks.HookPayload) void {
const info = payload.path_found;
std.log.info("Path found! Cost: {d}", .{info.cost});
}
};
const Dispatcher = pathfinding.hooks.HookDispatcher(MyHooks);
var astar = pathfinding.AStarWithHooks(Dispatcher).init(allocator);Other Changes
MergePathfindingHooksfor combining multiple hook handlersEmptyDispatcheras default when no hooks are needed- Hooks emit entity IDs (not internal indices) when using mapping methods