hex-world
    Preparing search index...

    Function getVisibleCells

    • Returns all cells visible from center within range steps.

      Simple BFS with no cost function — every step counts as 1. Cells beyond range steps are excluded. The center cell is always included (at distance 0). No line-of-sight blocking is applied; add that by filtering the result.

      Parameters

      • center: HexCoord
      • range: number
      • map: { width: number; height: number }

      Returns HexCoord[]

      const visible = getVisibleCells(
      offsetToHex(unitCol, unitRow),
      2,
      map,
      );