sourcenav
The sourcenav namespace provides a parser for Source engine .nav navigation mesh files (Version 16).
Function
Section titled βFunctionβlocal nav_data = sourcenav.parse(file_bytes: string) --> table | nilParses navigation mesh binary bytes (e.g. loaded via files.read). Returns nil if the file is invalid or not an analyzed version 16 mesh.
Returned Data Structure
Section titled βReturned Data StructureβThe returned table contains:
places: List of named map place regions (e.g."BombsiteA","Mid").ladders: List of navigation ladder connections.areas: List of navigation areas, where each area includes:id: Unique area IDnorth_west,south_east: Area boundingvectorcoordinatesconnections: Adjacent area connectionshiding_spots: Strategic cover and ambush pointsencounter_paths: Travel paths and battle segmentsladders: Attached ladder IDsvisible_areas: Line of sight area IDs
Example: Reading Map Nav Mesh
Section titled βExample: Reading Map Nav Meshβlocal map_name = common.get_map_shortname()local nav_path = string.format("csgo/maps/%s.nav", map_name)
if files.exists(nav_path) then local nav = sourcenav.parse(files.read(nav_path)) if nav then print(string.format("Loaded Nav Mesh for %s: %d areas, %d places", map_name, #nav.areas, #nav.places )) endend