scmJS docs

Walkability

scm-js/plugin-walkability, a default that starts on, is the worked example for a read-only analysis drawn over the map: Tools ▸ Walkability… (Ctrl+Shift+W) reads every tile's sixteen VF4 words through api.tileset.raw() (groups[id >> 4].megatiles[id & 15]megatileFlags), marks the ground under every building and resource (api.data.units() extents, or api.palette.unitSize without the tables) and hands the grid to analysis.ts, the pure part with that repository's tests: an exact Euclidean distance transform for clearance, 4-connected components for islands, a BWEM-style watershed over the clearance map for areas and the chokes between them (where two areas first touch is the widest point of the narrowest passage; too small an area, or a meeting point nearly as wide as the area itself, means they were one), seams (open cells at different heights touching with no ramp), and per start-location pair the ground distance (Dial's algorithm, no corner cutting) and the widest route (a flood by descending bottleneck) whose narrowest point is measured with passageWidth. api.query.startLocations() and api.query.placement(106, …) (a Command Center's footprint) give the start rows and the "hall spot not buildable" problem.

The result is an api.ui.overlay registered at activation (above: "objects", off until switched on) — View ▸ Walkability, the Layers panel, Ctrl+Shift+W or the panel's tick — whose draw blits one ImageData per view mode (areas, islands, clearance, height, walkable) scaled from minitiles to canvas pixels with smoothing off, then rings, labels and markers in canvas coordinates through view.x / view.y; onHover writes the cell under the pointer into the panel. Because an overlay never takes the pointer, the picture stays up while units and doodads are placed on it, and the analysis follows every edit (the "terrain", "units", "doodads", "settings" and "document" events, debounced) while it is showing or the panel is open. Picking an area is a pickTile. The panel (api.ui.panel) holds the settings, the readout and the problems; Details… opens a second panel with every start location, pair, island, area and choke, with api.view.center / api.view.goTo behind each row; Copy report is the text summary. The plugin never writes to the map.